Script Testing Portal Connections...
| From: | Kondwani Spike Mkandawire | Date: | Tue, 23 Jul 2002 13:10:32 +0000 |
| Subject: | Script Testing Portal Connections... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-109074@lists.php.net to get a copy of this message | ||
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";