找传奇、传世资源到传世资源站!

C# 网络即时通信程序 源码下载

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

1)用户之间的同步/异步的即时文字通讯 2)用户之间的文件传输功能; 3)至少支持在局域网内实现基本文字通信功能,考虑基于互联网的网络通信功能; 4)附加要求: A,支持音/视频功能; B,用户之间的通信参考QQ的弹窗效果; C,发送文件前,应经过接收方的允许后才发送; D,消息到达提醒功能;
C# 网络即时通信程序 源码下载 C#语言基础-第1张
处理接收的服务器的信息         /// <summary>        /// 处理接收的服务器端数据        /// </summary>        private voidReceiveServerData()        {            stringreceiveString = null;            while (isExit== false)            {               try               {                   //从网络流中读出字符串                   //此方法会自动判断字符串长度前缀,并根据长度前缀读出字符串                   receiveString = br.ReadString();               }               catch               {                   if (isExit == false)                   {                                               MessageBox.Show("与服务器失去联系。");                   }                   break;               }               string[] splitString= receiveString.Split(',');               string command = splitString[0].ToLower();               switch (command)               {                   case "login":  //格式:login,用户名                        AddOnline(splitString[1] "," splitString[2]);                        break;                   case "logout":  //格式:logout,用户名                       RemoveUserName(splitString[1] "," splitString[2]);                        break;                   case "talk":  //格式:talk,用户名,对话信息                        //AddTalkMessage(splitString[1] ":\r\n");                         //AddTalkMessage(receiveString.Substring(                        //   splitString[0].Length splitString[1].Length 2));                        AddTalkMessage(string.Format("{0}说:{1}",                           splitString[1],receiveString.Substring(                           splitString[0].Length splitString[1].Length 2)));                        break;                    default:                        AddTalkMessage("什么意思啊:" receiveString);                        break;               }            }        } 

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复