|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-10-17 02:15 UTC] wez@php.net
[2002-10-17 12:52 UTC] ces at vaultbbs dot com
[2002-10-17 17:07 UTC] sniper@php.net
[2002-10-17 21:59 UTC] wez@php.net
[2002-10-18 20:11 UTC] ces at vaultbbs dot com
[2002-10-18 20:11 UTC] ces at vaultbbs dot com
[2002-10-19 04:27 UTC] wez@php.net
[2002-10-19 05:35 UTC] wez@php.net
[2002-10-22 11:45 UTC] ces at vaultbbs dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 20:00:01 2025 UTC |
I am trying to use the CLI version of 4.3.0-pre1. My script needs to act if there hasn't been input within a certain amount of time. I've used the following function to accomplish this with TCP/IPsockets in non-blocking mode: function GetSocketLine($socket, $timeout) { $timeout += time(); $holdString = ""; while(time() < $timeout) { $string = fgets($socket, 1024); if($string != false) break; } return($string); } However, if I use set_stream_blocking() to set STDIN to non-blocking, the above code returns garbage instead of "false" when there is nothing to receive. It would seem to me that if STDIN is set to non-blocking and STDIN is passed to the above function as $socket, it ought to return "false" when blocking would occur--it shouldn't return garbage.