为什么我建立一个UDP Listen 会报错?
我想建立一个UDP的监听服务,为什么总是报错?
下面是代码:
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
socket.Bind(new IPEndPoint(IPAddress.Any, 11113));
socket.Listen(10);
最后一句就抛出一个10045的错误。
Operation not supported.
The attempted operation is not supported for the type of object referenced. Usually this occurs when a socket descriptor to a socket that cannot support this operation is trying to accept a connection on a datagram socket.