Re: Script Testing Portal Connections...

From: Date: Wed, 24 Jul 2002 11:10:26 +0000
Subject: Re: Script Testing Portal Connections...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-109283@lists.php.net to get a copy of this message
"Richard Lynch" <rich@phpbootcamp.com> wrote in message news:php.general-109225@news.php.net... > >#!/usr/local/bin/php -q > ><? > >// don't timeout! > >set_time_limit(0); > > > >// set some variables > >$host = "1.2.3.4..."; > >$port = 1234; > >$command = "/usr/games/fortune"; > > # I must be missing something, cuz I don't see where this $command is > used... $command is used further down in the script I din't post the whole thing coz it dies when it reaches the statement: $result = listen($socket, 3) or die("Set up Failed!"); i.e. output: Setup Failed! > >// create socket > >$socket = socket(AF_INET, SOCK_STREAM, 0) or die("Could not create > >socket\n"); > > > >// bind socket to port > >$result = bind($socket, $host, $port) or die("Could not bind to > >socket\n"); > > > >/* 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"; > > You do realize that it's *SUPPOSED* to just sit there waiting for somebody > to connect at this point, right?... > > It it saying "Set up Failed!"? > > I mean, it may *LOOK* like it "hangs" but it's really just > "waiting..." > > You'll need to open another shell window and poke at the port it's listening > to to get any action. > > Oh, and you probably need to use socket_listen, and not just "listen", I > think... Or are these the old function names?... I tested the Script on PHP 4.1.2 it does not have a definition for the functions socket_listen or socket_create hence you can only use socket() and listen() Thanks for the response... Spike...

« previous php.general (#109283) next »