Tag Archives: Wake-on-Lan

Wake-on-Lan (WoL) in C#

Wake on LAN is a computer networking standard that allows devices to be powered on when they receive a specific network message, if your device supports this feature.

In this example we will demonstrate how to craft this “magic” packet in C#. The concept of the packet is fairly simple. The packet must contain anywhere in the payload six (6) 255 bytes in a row (FF in hexadecimal) followed by the MAC address of the device repeated sixteen times.

As an example, if your device MAC address is 01-00-00-00-00-02 the payload will look like this:

You can find the implementation of WoL in C# below:

And the result…
Wireshark WoL Result

Feel free to leave your questions or feedback in the comment section below.