Jump to content

Wake on LAN help sending packet?


Recommended Posts

I am trying to setup Wake on LAN for a computer of mine. I read that you need a wireless adapter that supports it, so instead of going out and buying one, I have decided to hook two computers up with an ethernet cable. The other computer uses a wireless adapter, and stays on most of the time because its old and quiet. Now comes the hard part.

I know a decent bit about sending TCP/UDP, so I thought I will just have the other computer send the magic packet to 192.168.1.xxx, but as I run that through my head I am finding that might not work... The computer that's turned off gets its internet through the wireless adapter, so if the other computer tries to send it a packet, won't it still be trying to do it via the adapter? Is there a way to direct the packet to be sent through the ethernet cable?

Link to comment
Share on other sites

Yes, I know that is uses MAC addresses, and I was planning on writing my own script to send the magic packet. I guess I am a little confused with how UDP works then? Say the IP of the computer thats off is, would I just send a UDP message "FF FF FF FF FF FF [6-byte MAC address of ethernet cable 16 times]" to on port 9?

Edited by clonetrooper9494
Link to comment
Share on other sites

You don't use the receving (sleeping) computer's IP address, you'll have to send

its MAC-address (16 times) inside that magic packet over using a (UDP) datagram

as a network broadcast (IP address

In pseudo (Delphi) Pascal-code:

TMACAddress = Array[0..5] Of Byte;

TWakeRecord = Packed Record
Header : Array[0..15] Of Byte; // These are all $FF's
MAC : Array[0..15] Of TMACAddress;

Procedure WakeComputer(Const AMAC : TMACAddress);
I : Integer;
WR : TWakeRecord;
FillChar(WR.Header, SizeOf(WR.Header), $FF);
For I := 0 To 15 Do

SendPacket('udp', '', SomePort, WR);



Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.

  • Create New...