发送到指定ip和端口

UdpClient client= new UdpClient();
IPEndPoint endPoint = new IPEndPoint(IPAddress.Parse("192.168.1.2"), 8080);
var data = new byte[] { 65, 66, 67 };
client.Send(data, data.Length, endPoint);

发送广播

UdpClient client = new UdpClient();
IPEndPoint ipEndpoint = new IPEndPoint(IPAddress.Broadcast, 8000);
var data = new byte[] { 65, 66, 67 };
client.Send(data, data.Length, ipEndpoint);