note 22152 added to function.fsockopen
| From: | php-general at lists dot php dot net | Date: | Sat, 08 Jun 2002 07:46:02 +0000 |
| Subject: | note 22152 added to function.fsockopen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-31596@lists.php.net to get a copy of this message | ||
PHP Version 4.2.0/WIN32
<?PHP
$iptoopen="127.0.0.1";
$porttoopen = 2593;
$ltime=time();
$connection = fsockopen ($iptoopen, $porttoopen, &$errno, &$errstr, 1);
if (!$connection){
echo "Can not Connect: ($errno)-$errstr";
}else{
fputs($connection, "\n");
socket_set_timeout($connection, 1, 1);
echo "Ok I'am Connected to the port!";
}
$htime=time();
$ttime=($htime-$ltime);
echo "Time =$ttime Seconds!";
echo "Done! Closing port!";
fclose ($connection);
?>
If the port does not respond, it takes about 21 seconds to come back! Shouldnt it be 1 second? That
is what is stated in the "fsockopen"?
--
http://www.php.net/manual/en/function.fsockopen.php
http://master.php.net/manage/user-notes.php?action=edit+22152
http://master.php.net/manage/user-notes.php?action=delete+22152
http://master.php.net/manage/user-notes.php?action=reject+22152