下载此文档

c#带界面-客户端与服务器通信TCP.docx


文档分类:IT计算机 | 页数:约4页 举报非法文档有奖
1/4
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/4 下载此文档
文档列表 文档介绍
服务器端界面
服务器端代码:
using System;
using ;
using ;
using ;
es,0,);
rec = (bytes); = rec;
();
}
}
private void btnSend_Click(object sender, EventArgs e)
{
try
{
ns = (); byte[] bytes = new byte[1024];
// bytes = (sendmsg);
bytes = ( +"\r\n" + "服务器说: " + );
(bytes,0,);
= + "\r\n" + "服务器说:" +
;
();
}
catch { }
}
private void btnstop_Click(object sender, EventArgs e)
{
();
}
客户端界面:
客户端代码:
using System;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;//Endpoint
using ;
namespace
{
public partial class CLient : Form
{
TcpClient tcpClient = new TcpClient();
NetworkStream ns;
Thread myThread;
public CLient()
{
InitializeComponent();
}
private void CLient_Load(object sender, EventArgs e)
{
= false; myThread = new Thread(new ThreadStart(receive));

c#带界面-客户端与服务器通信TCP 来自淘豆网www.taodocs.com转载请标明出处.

非法内容举报中心
文档信息
  • 页数4
  • 收藏数0 收藏
  • 顶次数0
  • 上传人xiaobaizhua
  • 文件大小35 KB
  • 时间2022-05-20