|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-08-14 05:35 UTC] g at gsxm dot net
[2010-09-27 01:30 UTC] cataphract@php.net
-Status: Open
+Status: Feedback
-Assigned To:
+Assigned To: cataphract
[2010-09-27 01:30 UTC] cataphract@php.net
-Status: Feedback
+Status: Verified
[2010-09-27 04:09 UTC] cataphract@php.net
[2010-09-27 04:16 UTC] cataphract@php.net
[2013-01-06 09:01 UTC] gauthierm@php.net
[2013-01-06 09:23 UTC] gauthierm@php.net
[2014-07-18 12:18 UTC] rob at associatedtechs dot com
[2017-10-24 05:45 UTC] kalle@php.net
-Status: Verified
+Status: Assigned
[2022-10-16 11:33 UTC] bukka@php.net
-Status: Assigned
+Status: Closed
-Assigned To: cataphract
+Assigned To: bukka
[2022-10-16 11:33 UTC] bukka@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 15:00:02 2025 UTC |
Description: ------------ Using PHP CLI Gentoo 64 bit box PHP version 5.2.14 clean compile Dual AMD Opteron 2212 CPU Something is blocking in the code, it seems to be fread. I am sure this is not the expected result. I greatly simplified the sample I included. I can just put the socket/stream in non-blocking mode, but I would much prefer to use the code as I designed it. I have considered just using the socket functions in php or just writing the code in C. Once in a great while it will resume after about thirty to sixty seconds. In non-blocking mode I have no issues. This is a php cli script that connects to another daemon running on the same machine, I am using this php script to parse data to place in a sql database. Test script: --------------- $sock=@fsockopen("localhost","7777",$errno,$errstr,3); if (!$sock) { echo "sock error".$crlf; } while(true) { $read=array($sock); $write=NULL; $except=NULL; $status=@stream_select($read,$write,$except,1); if ($status===false) { echo "select error".$crlf; exit(); } if ($status>0) { $data = @fread($sock,128); echo $data; $out .= $data; } usleep(10000); } Expected result: ---------------- The loop should run for eternity as expected. Actual result: -------------- The loop is blocked, I am presuming by fread due to a failure of the expected behavior of stream_select.