A little bit of everything answered here. : tribes1ms3

HomePage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register
Oldest known version of this page was edited on 2007-08-01 16:02:24 by JimLucas []
Page view:
#!/usr/local/bin/php -q
<?php
// Set time limit to indefinite execution
set_time_limit (0);

// Set the ip and port we will listen on
$IP = '66.39.167.51';
$PORT = 28000;
$packet_size = 1024;


$i = 0;
/* Open a server socket to port 1234 on localhost */
if ( $server = @stream_socket_server("udp://{$IP}:{$PORT}", $errno, $errstr, STREAM_SERVER_BIND) ) {
   
        while ( $i++ < 5 ) {
   
        /* Get the exact same packet again, but remove it from the buffer this time. */
        $raw_data = stream_socket_recvfrom($server, $packet_size, 0, $remote_ip);

        echo "Heart Beat from IP:{$remote_ip}\n";
       
        $unpacked = unpack('C3', $raw_data);
       
        print_r($unpacked);

    }

    fclose($server);
} else {
    echo "Socket Server Failure\n";
}
?>
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki 1.1.6.2
Page was generated in 0.3518 seconds