Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.Connect(new IPEndPoint(IPAddress.Parse("192.168.1.1"), 8080));
Console.WriteLine("连接服务器成功");
socket.Send(Encoding.UTF8.GetBytes("demo"));
await Task.Delay(1000);
C#用socket写TCP Client向TCP 服务器发消息
最新推荐文章于 2024-08-01 17:59:21 发布