WakeOnLAN is a C++ tool to remotely power on a PC using the Wake-on-LAN (WOL) protocol. It sends a magic packet with the target PC’s MAC address over UDP, with error handling for invalid inputs or network issues. Built for beginners, it supports both Windows and Linux, demonstrating cross-platform network programming. The target PC must have WOL enabled in its BIOS and network settings.
- Sends WOL magic packet to wake a PC
- Validates MAC address input
- Provides clear error messages
- Cross-platform: Windows and Linux
- Windows: C++ compiler (e.g., MinGW, Visual Studio), Winsock library
- Linux: C++ compiler (e.g., g++)
- Target PC: WOL enabled, same local network
- Clone the repository:
git clone https://github.com/AsifMinar/WakeOnLAN.git
- Ensure
wol.cppis in the project directory.
- Windows (MinGW):
g++ -o wol wol.cpp -lws2_32
- Linux:
g++ -o wol wol.cpp
- Windows:
Run as Administrator if permission denied.
wol.exe
- Linux:
sudo ./wol
Enter the target PC’s MAC address (e.g., 00:11:22:33:44:55).
Example:
Enter MAC address (example: 00:11:22:33:44:55): 00:11:22:33:44:55
Magic packet sent successfully!
- Ensure the target PC has WOL enabled.
- Run on the same network as the target PC.
- Enter a valid MAC address and verify the PC powers on.
- Test invalid MAC addresses for error handling.
- Uses IPv4 broadcast (
255.255.255.255) on port 9. - Linux may require
sudo; Windows may need admin rights. - Supports MAC format
XX:XX:XX:XX:XX:XXonly.