C#源代码 如何实现点对点的聊天

上传者: joeyxiaobin | 上传时间: 2019-12-21 20:01:06 | 文件大小: 56KB | 文件类型: rar
C#源代码 如何实现点对点的聊天,一个比较详尽的实现点对点聊天的源代码 核心代码: string MyMessage= this.textBox2.Text+":"+this.richTextBox1.Text+"\n"; //根据目标计算机地址建立连接 TcpClient MyTcpClient = new TcpClient(this.textBox1.Text, 888); //获得用于网络访问的数据流 NetworkStream MyTcpStream =MyTcpClient.GetStream(); StreamWriter MyStream = new StreamWriter(MyTcpStream); //将字符串写入流 MyStream.Write(MyMessage); //将缓冲数据写入基础流 MyStream.Flush(); //关闭网络流 MyStream.Close(); MyTcpClient.Close(); this.richTextBox3.AppendText(this.richTextBox1.Text+"\n"); this.richTextBox1.Clear();

文件下载

资源详情

[{"title":"( 33 个子文件 56KB ) C#源代码 如何实现点对点的聊天","children":[{"title":"C#源代码 如何实现点对点的聊天","children":[{"title":"AssemblyInfo.cs <span style='color:#111;'> 1.82KB </span>","children":null,"spread":false},{"title":"UpgradeLog.XML <span style='color:#111;'> 3.61KB </span>","children":null,"spread":false},{"title":"System.suo <span style='color:#111;'> 8.00KB </span>","children":null,"spread":false},{"title":"Network.sln <span style='color:#111;'> 898B </span>","children":null,"spread":false},{"title":"MoveWindow.suo <span style='color:#111;'> 7.50KB </span>","children":null,"spread":false},{"title":"Backup","children":[{"title":"AssemblyInfo.cs <span style='color:#111;'> 1.82KB </span>","children":null,"spread":false},{"title":"Network.sln <span style='color:#111;'> 899B </span>","children":null,"spread":false},{"title":"App.ico <span style='color:#111;'> 1.05KB </span>","children":null,"spread":false},{"title":"Form1.cs <span style='color:#111;'> 8.47KB </span>","children":null,"spread":false},{"title":"Network.csproj <span style='color:#111;'> 4.64KB </span>","children":null,"spread":false},{"title":"Form1.resx <span style='color:#111;'> 12.33KB </span>","children":null,"spread":false},{"title":"Network.csproj.user <span style='color:#111;'> 1.76KB </span>","children":null,"spread":false},{"title":"Network.suo <span style='color:#111;'> 7.50KB </span>","children":null,"spread":false}],"spread":true},{"title":"obj","children":[{"title":"Release","children":[{"title":"Network.exe <span style='color:#111;'> 28.00KB </span>","children":null,"spread":false},{"title":"temp","children":null,"spread":false},{"title":"Network.csproj.FileListAbsolute.txt <span style='color:#111;'> 189B </span>","children":null,"spread":false},{"title":"Network.projdata <span style='color:#111;'> 6.13KB </span>","children":null,"spread":false},{"title":"Network.Form1.resources <span style='color:#111;'> 8.92KB </span>","children":null,"spread":false},{"title":"TempPE","children":null,"spread":false}],"spread":true},{"title":"Debug","children":[{"title":"TempPE","children":null,"spread":false}],"spread":true}],"spread":true},{"title":"bin","children":[{"title":"Release","children":[{"title":"Network.exe <span style='color:#111;'> 28.00KB </span>","children":null,"spread":false},{"title":"Network.vshost.exe <span style='color:#111;'> 13.99KB </span>","children":null,"spread":false},{"title":"Network.vshost.exe.manifest <span style='color:#111;'> 490B </span>","children":null,"spread":false}],"spread":true},{"title":"Debug","children":null,"spread":false}],"spread":true},{"title":"App.ico <span style='color:#111;'> 1.05KB </span>","children":null,"spread":false},{"title":"Form1.cs <span style='color:#111;'> 8.47KB </span>","children":null,"spread":false},{"title":"PortCheck.suo <span style='color:#111;'> 7.50KB </span>","children":null,"spread":false},{"title":"Network.csproj <span style='color:#111;'> 4.05KB </span>","children":null,"spread":false},{"title":"Ping.suo <span style='color:#111;'> 7.50KB </span>","children":null,"spread":false},{"title":"Form1.resx <span style='color:#111;'> 12.33KB </span>","children":null,"spread":false},{"title":"Network.csproj.user <span style='color:#111;'> 2.03KB </span>","children":null,"spread":false},{"title":"_UpgradeReport_Files","children":[{"title":"UpgradeReport.css <span style='color:#111;'> 3.27KB </span>","children":null,"spread":false},{"title":"UpgradeReport_Plus.gif <span style='color:#111;'> 71B </span>","children":null,"spread":false},{"title":"UpgradeReport.xslt <span style='color:#111;'> 12.21KB </span>","children":null,"spread":false},{"title":"UpgradeReport_Minus.gif <span style='color:#111;'> 69B </span>","children":null,"spread":false}],"spread":false},{"title":"Image.suo <span style='color:#111;'> 7.50KB </span>","children":null,"spread":false},{"title":"Network.suo <span style='color:#111;'> 10.00KB </span>","children":null,"spread":false}],"spread":false}],"spread":true}]

评论信息

  • hai22545 :
    对我这样的初学者很有用,谢谢分享
    2015-07-22
  • 堕之羽翼 :
    最简单的TCP通讯。还是局域网的,没有穿透nat之说,初心者可以下了模仿下下。
    2011-11-17

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明