Um...did you happen to modify this to have a valid IP address or host
name for $host and a valid port number for $port? It would also help to
have a valid path for $command that is going to talk to a daemon on the
port you specify (ie. making a connection to port 80 and asking for
/usr/games/fortune is not to going to get you far). If you have made
those modifications and it's still failing, some information about what
actually happens in the failure might be helpful.
On Tue, 2002-07-23 at 06:10, Kondwani Spike Mkandawire wrote:
> I am trying to test a Script which I got online and
> will modify later (its from devshed)... It fails to set
> up a connection...
> #!/usr/local/bin/php -q
> // don't timeout!
> // set some variables
> $host = "126.96.36.199...";
> $port = 1234;
> $command = "/usr/games/fortune";
> // create socket
> $socket = socket(AF_INET, SOCK_STREAM, 0) or die("Could not create
> // bind socket to port
> $result = bind($socket, $host, $port) or die("Could not bind to
> /* start listening for connections
> * My Script Fails here...
> * Any suggestions why it fails the Socket SetUp...
> * Should I screw around with the port numbers?
> $result = listen($socket, 3) or die("Set up Failed!");
> echo "Waiting for connections...\n";
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php