[PHP] Script Testing Portal Connections...

2002-07-23 Thread Kondwani Spike Mkandawire

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_time_limit(0);

// set some variables
$host = 1.2.3.4...;
$port = 1234;
$command = /usr/games/fortune;

// 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;






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Script Testing Portal Connections...

2002-07-23 Thread Michael Sweeney

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.

..mike..

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_time_limit(0);
 
 // set some variables
 $host = 1.2.3.4...;
 $port = 1234;
 $command = /usr/games/fortune;
 
 // 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;
 
 
 
 
 
 
 -- 
 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




Re: [PHP] Script Testing Portal Connections...

2002-07-23 Thread Kondwani Spike Mkandawire


Michael Sweeney [EMAIL PROTECTED] wrote in message
1027447470.3349.28.camel@catalyst">news:1027447470.3349.28.camel@catalyst...
 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

*Obviously* I modified it to be tested at a valid host and address the
IP address I have used for this post a dummy address in this post...
Obviously
I am not going to post a valid IP number from the Work Station on
which I am working on due to security issues...  I am obviously not
going to test an IP number 1.2.3.4

 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.

It dies i.e it executes the die statement:  SetUp Failed! as shown
in the code...  I have got an accept statement after it but if its not
reaching this satement there was no point in posting it up...

Thanks for the response though...

Spike...

 ..mike..

 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_time_limit(0);
 
  // set some variables
  $host = 1.2.3.4...;
  $port = 1234;
  $command = /usr/games/fortune;
 
  // 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;
 
 
 
 
 
 
  --
  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