Skip to content

Instantly share code, notes, and snippets.

@aquiladev
Created June 17, 2018 19:41
Show Gist options
  • Save aquiladev/50605febb0037aee0b4439eca9530829 to your computer and use it in GitHub Desktop.
Save aquiladev/50605febb0037aee0b4439eca9530829 to your computer and use it in GitHub Desktop.
class Program
{
static void Main(string[] args)
{
Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
IPAddress broadcast = IPAddress.Parse("192.168.1.102");
byte[] sendbuf = Encoding.ASCII.GetBytes("{11111111111}");
IPEndPoint ep = new IPEndPoint(broadcast, 1700);
Console.WriteLine(sendbuf.Length);
s.SendTo(sendbuf, ep);
Console.WriteLine("Message sent to the broadcast address");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment