tags:

views:

1093

answers:

1

What's the best way going forward to implement Wake on LAN using C#?

The functionality is needed for machines in a LAN environment (and not over the internet). The method needs to be robust enough to take care of firewalls and other such issues. Also, for systems not supporting this functionality, or having it disabled, is there an alternative?

The primary objective - wake up machines (from shutdown/hibernate state) over the LAN - this is to be programmed using C#.

Please guide.

PS: I've come across the following:

http://blog.memos.cz/index.php/team/2008/06/12/wake-on-lan-in-csharp http://community.bartdesmet.net/blogs/bart/archive/2006/04/02/3858.aspx http://www.codeproject.com/KB/IP/cswol.aspx

However, I'm new to this and hence couldn't figure if the solutions were comprehensive enough. If someone could recommend following either of the above articles, that'd help.

+5  A: 

For the WOL problem you have to clarify three problems to get it to work:

  1. Send a WOL over the ethernet cable
  2. Configure your PC to listen for such a packet and wake up
  3. Make sure the packet will come from sender to receiver (firewall, gateways, etc.)

As you already found on the net there are existing several solutions for the first problem programmed in C# (and after skim your links i would start with the first one).

The second one is something you can only achieve by configuring your network adapter. Just open the device manager and take a look into the properties of your network adapter, if such an option exists and if you can enable it. This can't be programmed, due to the fact that every network adapter has another implementation of that function and how it can be enabled.

The third problem can't also be solved by C#. It is a pure network problem, where you have to configure your router, gateways, ids-systems, etc. to allow such a packet and let it flow from sender to receiver. Due to the fact, that a WOL packet is always a broadcast packet (dest-ip 255.255.255.255) it won't leave your local network and will always be dropped from router, gateways or any other bridge between to networks (e.g. vpns, etc.).

Last but not least i will just remind you, that the first problem can be divided into some smaller packets but as far as i could see these problems are all capped by the links you provided.

Oliver