Ver Mensaje Individual
  #1 (permalink)  
Antiguo 29/01/2011, 00:07
the_calentano
 
Fecha de Ingreso: marzo-2008
Mensajes: 2
Antigüedad: 16 años, 1 mes
Puntos: 0
Pregunta AYUDA con wake on lan

hola que tal miren el problema que tengo es que no me funciona este codigo no me marca error nada y con el programa wake on lan anda sin problemas me podrian ayudar es urgente porfavor.

<?php
# Wake on LAN - (c) HotKey (at SPR dot AT), upgraded by Murzik <[email protected]>

flush();

function WakeOnLan($addr, $mac)
{
$addr_byte = explode(':', $mac);
$hw_addr = '';

for ($a=0; $a < 6; $a++) $hw_addr .= chr(hexdec($addr_byte[$a]));

$msg = chr(255).chr(255).chr(255).chr(255).chr(255).chr(2 55);

for ($a = 1; $a <= 16; $a++) $msg .= $hw_addr;

// send it to the broadcast address using UDP
// SQL_BROADCAST option isn't help!!
$s = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
if ($s == false)
{
echo "Error creating socket!\n";
echo "Error code is '".socket_last_error($s)."' - " . socket_strerror(socket_last_error($s));
}
else
{
// setting a broadcast option to socket:
$opt_ret = socket_set_option($s, 1, 6, TRUE);
if($opt_ret < 0)
{
echo "setsockopt() failed, error: " . strerror($opt_ret) . "\n";
}
$e = socket_sendto($s, $msg, strlen($msg), 0, $addr, 2050);
socket_close($s);
echo "Magic Packet sent (".$e.") to ".$addr.", MAC=".$mac;
}
}



este codigo lo encontre en internet y no me anda me podiran ayudar porfavor