By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,334 Members | 2,776 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,334 IT Pros & Developers. It's quick & easy.

C# UDP Help

P: 1
Hi All:

I am very new to C# and using UDP protocol. I have a C# application, and I am trying to simply broadcast/multicast (whichever is better) a message to one or more devices on a LAN Network to get them to restart using the #RESTART ASCII Command. Here is my code:

Expand|Select|Wrap|Line Numbers
  1. PAddress GroupAddress = IPAddress.Broadcast;
  4. int GroupPort = 8001;
  6. IPEndPoint groupEP = new IPEndPoint(GroupAddress, GroupPort);
  8. string str = "#RESTART";
  10. byte[] sendBytes = Encoding.ASCII.GetBytes(str);
  13. Thread.Sleep(1000);
  15. sender.Send(sendBytes, sendBytes.Length, groupEP);

Upon receiving the command, the device(s) should instantaneously restart without having to dsend anything back to the application. This code does compile/build correctly with Visual Studio .NET 2003, but it doesn't do anything...can someone out there help me?? Is converting the #RESTART command to ASCII characters the wrong route to take?

Once again, to recap:

I am trying to broadcast the restart message to all devices on my LAN network. Once they receive this message, they should all instantenously restart. Please help me fix my code.

Apr 19 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.