In the area network, the Magic Packet can be sent to the host's network card, Magic Packet has 6 "FF", and then 16 network card MAC, when the main version of the open support Wake on LAN function, the network card received a match the magic Packe T, you can start the computer. (each main version of the Wake on LAN has the same name, such as PME Event Wake up, Power on by PCI Devices ...)
Another effect is the possibility of setting up the network, in the operating system of the installation Manager, the network card in the power management, you need to tick "allow this device to wake the computer."
The fake network card MAC is: 01-02-03-04-05-06
Inside the Magic Packet:
FFFFFFFFFFFF0102030405060102030405060102030405060102030405060102030405060102030405060102030405060102030405060102030405060 10203040506010203040506010203040506010203040506010203040506010203040506010203040506
Then Port 7, or Port 9, which is sent to the computer by using UDP messaging
So the way to do this is to be able to send the Internet to the computer magic Packet, if it is used to send the magic Packet's equipment (Server), there is also an external connection, also can achieve the effect of external network.
The following PHP sends the Magic Packet example source
Wol:wake-on-lan Tutorial with Bonus PHP Script
Only slightly modified as follows:
Class WakeOnLAN {/** * awakens the computer * @param type $addr, target IP or broadcast address (format 01-02-03-04-05-06 or 01:02:03:04:05:06) * @ PARAM type $mac * @param type $port, 7 or 9 * @return Boolean */Public function Wake ($ADDR, $mac, $port) {$mac = Str_replace ("-", ":", $mac); $addr _byte = Explode (': ', $mac); $HW _addr = "; for ($a = 0; $a < 6; $a + +) {$hw _addr. = Chr (Hexdec ($addr _byte[$a])); }//Start six "FF" $msg = Chr (255). Chr (255). Chr (255). Chr (255). Chr (255). Chr (255); 16 mac for ($a = 1; $a <=, $a + +) {$msg. = $HW _addr; }//Open a UDP socket//AF_INET:IP4//sock_dgram:the UDP protocol is based on the this socket type SOL_UDP: Using UDP messaging to set $skt = Socket_create (Af_inet, Sock_dgram, SOL_UDP); $err = Array (); if ($skt = = = False) {$err [] = "Error creating socket!"; $err [] = "Error code is". Socket_last_error ($skt). "' - " . Socket_strerror (Socket_last_error ($skt)); throw new Exception (implode ("\ n", $err)); } else {//set use broadcast to broadcast messages//$opt _ret = Socket_set_option ($skt, 1, 6, TRUE); $opt _ret = socket_set_option ($skt, Sol_socket, So_broadcast, true); if ($opt _ret = = = False) {$err [] = "setsockopt () failed, error:". Socket_strerror (Socket_last_error ($skt)); throw new Exception (implode ("\ n", $err)); } if (Socket_sendto ($skt, $msg, strlen ($msg), 0, $addr, $port)) {//magic Packet sent successful Ly $res = Trim (Socket_strerror (Socket_last_error ($skt))); Socket_close ($skt); return $res; } else {$err [] = "Magic packet failed!"; throw new Exception (implode ("\ n", $err)); }}}} $WOL = new WakeOnLAN (), try {$res = $WOL->wake (' 192.168.0.255 ', "01-02-03-04-05-06 ", 7); $res = $WOL->wake (' 192.168.0.255 ', "01-02-03-04-05-06", 9); Var_dump ($res);} catch (Exception $ex) {var_dump ($ex->getmessage ());}
Internet Awakening-Wikipedia, the free encyclopedia
Setting up Windows 8 Internet wake-Up (Wake on LAN)-dark threading
Php:socket_create-manual
Php:socket_set_option-manual
Php:socket_get_option-manual
Arduino-php:send an UDP broadcast message, and wait the Response-stack Overflow
The primitive tribe of small Letter pigs: [TCP/IP Illustrated] Broadcasting & multicasting