TCP 通信
TCP 服务端
Socket tcpServer = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
IPAddress ipAddress = new IPAddress(new byte[] {
192, 168, 1, 5 });
IPEndPoint ipEndPoint = new IPEndPoint(ipAddress, 7788);
tcpServer.Bind(ipEndPoint); // 绑定IP和端口号
tcpServer.Listen(100); // 设置最多有100人连接
Console.WriteLine("开始接客了...");
Socket client = tcpServer.Accept();
Console.WriteLine("一个客户端连接过来了!");
// 接收消息
byte[] data = new byte