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

From: Date: Sun, 22 Apr 2007 20:55:44 +0000
Subject: #41166 [Opn]: fpassthru and the other read-Funktions are very very slow
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-111787@lists.php.net to get a copy of this message
ID: 41166 User updated by: alex dot taeffner at vr-web dot de Reported By: alex dot taeffner at vr-web dot de Status: Open Bug Type: Sockets related Operating System: Debian Linux PHP Version: 5.2.1 New Comment: 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? Previous Comments: ------------------------------------------------------------------------ [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 (#111787) next »