http://grimore.i2p/networking/wake_on_lan/generating_wol_packets
$password ; # Allocate socket and send packet $raddr = gethostbyname ( $ipaddr ) ; $them = pack_sockaddr_in ( $port , $raddr ) ; $proto = getprotobyname ( 'udp' ) ; socket ( S , AF_INET , SOCK_DGRAM , $proto ) or die "socket : $!" ; setsockopt ( S , SOL_SOCKET , SO_BROADCAST , 1 ) or die "setsockopt : $!" ; print "Sending magic packet to $ipaddr:$port with $hwaddr \n " ; send ( S , $pkt , 0 , $them ) or die "send : $!"