udp 10054
udp 收发数据时出现10054的异常,解决方法如下:
_socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
uint IOC_IN = 0x80000000;
uint IOC_VENDOR = 0x18000000;
uint SIO_UDP_CONNRESET = IOC_IN | IOC_VENDOR | 12;
_socket.IOControl((int)SIO_UDP_CONNRESET, new byte[] { Convert.ToByte(false) }, null);
IPEndPoint local = new IPEndPoint(Dns.GetHostEntry(Dns.GetHostName()).AddressList[0], 8087);
_socket.Bind(local);
红色字体部分为重点