#41166 [Opn->Bgs]: fpassthru and the other read-Funktions are very very slow

From: Date: Sun, 22 Apr 2007 21:20:41 +0000
Subject: #41166 [Opn->Bgs]: fpassthru and the other read-Funktions are very very slow
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-111789@lists.php.net to get a copy of this message
ID: 41166 Updated by: helly@php.net Reported By: alex dot taeffner at vr-web dot de -Status: Open +Status: Bogus Bug Type: Sockets related -Operating System: Debian Linux +Operating System: * -PHP Version: 5.2.1 +PHP Version: * New Comment: Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. The long time for the original code is obviously a result of running into a timeout, which has nothing to do with PHP. It appears you need to figure out how the protocol tells you when the answer is sent out completely. This has nothing to do with PHP at all. Previous Comments: ------------------------------------------------------------------------ [2007-04-22 20:55:44] alex dot taeffner at vr-web dot de I've just found out another thing: If I close the TCP-Connection (Telnet) before I use the command it works fine. I mean it like that: fputs($TS_link, "dbuserid 2\n"); fputs($TS_link, "quit\n"); while(!feof($TS_link)) { $out .= fgets($TS_link, 1024); } print $out; Works fine! BUT fputs($TS_link, "dbuserid 2\n"); while(!feof($TS_link)) { $out .= fgets($TS_link, 1024); } print $out; lasts very verry long! My big problem: I cannot quit before I have read it because I want to read a value of the answer and use it in the next query. Is there another way? ------------------------------------------------------------------------ [2007-04-22 20:18:50] alex dot taeffner at vr-web dot de Description: ------------ Every Function which reads the answar of a TCP-Server Completely (since the last read (Pointer-Position to EOF)) hangs very long while executing the script. fputs($TS_link, "help\n"); Well... If I write print fread($TS_link, 1024); The Script returns the LAST line: OK If I write fpassthru($TS_link); The Script loads more than a minute and returns ALL LINES since the last read. It doesnt matter if there are yust two lines or een one line or if there are 100 lines to read. Even if I write while (!feof($TS_link)) { print fgets($TS_link); } or while (!feof($TS_link)) { print fread($TS_link); } It is the same Problem. It occurs whith every possibility. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41166&edit=1

« previous php.bugs (#111789) next »