php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #29569 stream_set_timeout does not allow you to disable timeout
Submitted: 2004-08-08 06:00 UTC Modified: 2004-08-08 06:29 UTC
From: rob at rem5 dot com Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 5.0.0 OS: NIX 2.4.x
Private report: No CVE-ID: None
 [2004-08-08 06:00 UTC] rob at rem5 dot com
Description:
------------
when trying to keep a stream open using stream_set_timeout it will not allow the connection to stay open. I tried setting it to 0.. as well as 9999999999999999999999999. However it will not stay open more than 30 seconds.

Reproduce code:
---------------
#!/usr/local/php5/bin/php -qn
<?php
$socket = stream_socket_server("tcp://0.0.0.0:8000", $errno, $errstr);
stream_set_timeout($socket, 99999999999999999999999999999999999999);
if (!$socket) {
  echo "$errstr ($errno)<br />\n";
} else {
  while ($conn = stream_socket_accept($socket)) {
   fwrite($conn, "Simple Echo Using stream_socket_server() in PHP");
   $foo = fgets($conn);
   fwrite($conn, $foo);
   fclose($conn);
  }
  fclose($socket);
}
?>


Expected result:
----------------
stream_socket_server() should stay open and accepting connections.

Actual result:
--------------
craps out after 30 secs

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-08 06:29 UTC] rob at rem5 dot com
error with my script and my head.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sat May 28 04:06:34 2022 UTC