note 32176 added to function.stream-set-timeout
| From: | kesl at softhome dot net | Date: | Mon, 19 May 2003 18:05:50 +0000 |
| Subject: | note 32176 added to function.stream-set-timeout | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-48602@lists.php.net to get a copy of this message | ||
this thing isnt working at all or i am so dumb!
i created y.php which only echoes one string and waits 7 sec. why doesnt this x.php [below] finish
in 3 sec? it should! instead of 3, it finishes in 7 what means timeout is not working.
<?
define("cTIMEOUT", 3);
define("cHOST", "velenje.com");
$xSocket = fsockopen(cHOST, 80, $errno, $errstr, cTIMEOUT);
socket_set_blocking($xSocket, 1);
socket_set_timeout($xSocket, cTIMEOUT, 0);
fputs($xSocket, "GET /y.php HTTP/1.0\r\nHost: " . cHOST . "\r\n\r\n");
while (!feof($xSocket))
{
$x = fread($xSocket, 3000);
}
echo "*** DONE ***";
?>
----
Manual Page -- http://www.php.net/manual/en/function.stream-set-timeout.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+32176
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+32176&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+32176&report=yes