A little bit of everything answered here. : tribes1ms2

HomePage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register
If you want to run this from the command line, follow these instructions

You must have the PHP CLI installed on your server and running PHP 5.0 or newer.

Copy and paste the following code into a file on your server and save it with the .php extension.

You might need to adjust the location of you php executable.

I always log in with ssh to my server and issue this command.

./nameofscript.php

#!/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
$address = '66.39.167.51';
$port = 28000;

// Create a TCP Stream socket
if ( $sock = socket_create(AF_INET, SOCK_DGRAM, 0) ) {
    echo "Socket created\n";
    // Bind the socket to an address/port
    if ( socket_bind($sock, $address, $port) or die('Could not bind to address') ) {
        echo "Socket Bound to 'IP:{$address}:{$port}'\n";
        // Start listening for connections
        if ( socket_listen($sock) ) {
            echo "Listening...\n";
        }
    }
}

$i = 0;
// Loop continuously
while ($i++ < 5) {

    echo socket_read($sock, 1024);

} // end while
// Close the master sockets
socket_close($sock);
?>

There are no comments on this page. [Add comment]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki 1.1.6.2
Page was generated in 0.3842 seconds