January 6th, 2006, 04:59 PM
C/C++ Wake on LAN program
I work for a secondary school in the U.K. and we have currently just implemented a "wake on LAN" program and a similar program to close down the computers of a night. Although the problem is that the programs are products of two different companies and therefore their integration with one another is severally lacking.
Therefore I am considering creating my own program to handle both the booting up and shutting down of the computers. Initially in C and then latter with a GUI in C++.
Therefore I was hoping that someone would be able to provide me with the vital sections of code that send the boot up packet and shut down packet.
Thank you in advance.
January 6th, 2006, 10:26 PM
I don't think there are any boot up or shutdown packets. You're going to need a program listening on the machines you want to bootup or shut down that will do so when they come across a certain predefined packet to tell them to. Also, it will need to either have authentication, or only run during a certain time frame when the computers are to be shut down or booted up. I say that like I know exactly what it needs to do. Well I don't, and I don't know how to program it either. Just throwing out ideas. Good luck.
January 10th, 2006, 05:20 AM
There is a boot-up packet, but there is no shut-down packet (as far as I know). The boot-up packet is actually a specially crafted ethernet frame that can be sent via almost any protocol (TCP, IPX, UDP, etc..).
Programmatically I believe you can use any type of network/sockets library to construct the special bootup frame/packet and just send it to the computer you want to turn on. To turn off the computer, you will probably have to use syscall's for whatever operating system you are interfacing with.
A good reference that I just google'd is the Wake on LAN mini HOWTO.
It explains how Wake On LAN works and has program examples for both Windows and Linux in various languages (PERL, Visual Basic, C, even vb-script!). I think that should get you started.