A little bit of everything answered here. : tribes1ms2

HomePage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register
Most recent edit on 2007-08-01 16:16:02 by JimLucas

Additions:
~-Fedora 6 the php binary is located in /usr/bin/php

Deletions:
-Fedora 6 the php binary is located in /usr/bin/php



Edited on 2007-08-01 16:14:58 by JimLucas

Additions:
~-OpenBSD 4.1 the php binary is located in /usr/local/bin/php

Deletions:
-OpenBSD 4.1 the php binary is located in /usr/local/bin/php



Edited on 2007-08-01 16:14:21 by JimLucas

Additions:
./nameofscript.php

Deletions:
./nameofscript.php



Edited on 2007-08-01 16:14:01 by JimLucas

Additions:
./nameofscript.php

Deletions:
#



Edited on 2007-08-01 16:13:31 by JimLucas

Additions:
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.
-OpenBSD 4.1 the php binary is located in /usr/local/bin/php
-Fedora 6 the php binary is located in /usr/bin/php
I always log in with ssh to my server and issue this command.
#




Edited on 2007-08-01 16:07:44 by JimLucas

No differences.


Oldest known version of this page was edited on 2007-08-01 16:07:27 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
$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);
?>
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki 1.1.6.2
Page was generated in 0.5250 seconds