解决C#广播,很简单 C#中发送广播消息的过程如下,注意要调用SetSockOption函数,不然要抛出异常: Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); IPEndPoint iep1 = new IPEndPoint(IPAddress.Broadcast, 9050);//255.255.255.255 IPEndPoint iep2 = new IPEndPoint(IPAddress.Parse("