如何利用C#实现UDP协议的发送与接收?

2024-12-16 12:37:26
推荐回答(1个)
回答1:

参见TCP协议,差别在在这里

      FileSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Udp);//UDP

      FileSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);//Tcp

送上小例子一份,自己修改成UDP的!!我这个是发送List集合的例子哈!!