Doc #60273 [Opn->Wfx]: stream-set-timeout not clear about how it works and how it should be used

From: Date: Sat, 03 Dec 2011 23:21:29 +0000
Subject: Doc #60273 [Opn->Wfx]: stream-set-timeout not clear about how it works and how it should be used
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-7530@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=60273&edit=1 ID: 60273 Updated by: frozenfire@php.net Reported by: ibaldo at adinet dot com dot uy Summary: stream-set-timeout not clear about how it works and how it should be used -Status: Open +Status: Wont fix Type: Documentation Problem Package: Documentation problem PHP Version: trunk-SVN-2011-11-11 (SVN) Block user comment: N Private report: N New Comment: I can appreciate that some people may not understand this function if they're not familiar at all with streams, but the concept of a stream timeout is fairly well-established for those who've used them before in any language. The set stream timeout is how long an operation will wait when reading, before it gives up. There's no ambiguity about that. It's relative to when you call the read. As for the default, I'm somewhat certain that the default timeout on sockets is set by your system. There's no default set by PHP itself, that I'm aware of. In any case, these are not things that need to be discussed on this function's reference. Previous Comments: ------------------------------------------------------------------------ [2011-11-11 19:50:00] ibaldo at adinet dot com dot uy Description: ------------ --- From manual page: http://www.php.net/function.stream-set-timeout#refsect1-function.stream-set-timeout-description --- It is not clear to me if it refers to a timeout since the last byte received from the stream or a timeout since the stream has been opened. For example, if I set a timeout of 5 seconds with this function, if I receive data without problems, will it stop at 5 seconds even if I am receiving data? Or will it stop after not receiving data for 5 seconds? And, what is the default timeout? Also, some people say that you should call it everytime after a fwrite otherwise the fread will not timeout. Other people say that before doing the fread one should check the timed_out field of the array returned by stream_get_meta_data. Someone with the right knowledge should improve the documentation substantially since its not clear at all. The example should be done with a loop to show people how to read correctly with timeout handling in a loop since fread can bring less data than there is really available or requested. Thanks. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=60273&edit=1

« previous php.doc.bugs (#7530) next »