Re: Net_Socket::readLine() problem
| From: | Chuck Hagenbuch | Date: | Fri, 03 Sep 2004 20:46:06 +0000 |
| Subject: | Re: Net_Socket::readLine() problem | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-14400@lists.php.net to get a copy of this message | ||
Quoting Andreas Korthaus <akorthaus@web.de>:
But this does not work, because readLine() does not return the line "\n" as "", this \n is added to the next line, so readline only returns "\nklaus"I can't reproduce this: require_once './Socket.php'; $socket = &new Net_Socket(null); echo "with readLine():\n"; $socket->fp = fopen('./lines.txt', 'r'); var_dump($socket->readLine()); var_dump($socket->readLine()); var_dump($socket->readLine()); var_dump($socket->readLine()); var_dump($socket->readLine()); echo "\n\nwith gets():\n"; $socket->fp = fopen('./lines.txt', 'r'); var_dump($socket->gets(32)); var_dump($socket->gets(32)); var_dump($socket->gets(32)); var_dump($socket->gets(32)); var_dump($socket->gets(32)); with lines.txt being: 202 List follows Count: 1 Content-Length: 5 klaus gives me: Maya:/usr/local/src/pear/Net_Socket chuck$ php readline.php with readLine(): string(16) "202 List follows" string(8) "Count: 1" string(17) "Content-Length: 5" string(0) "" string(5) "klaus" with gets(): string(17) "202 List follows " string(9) "Count: 1 " string(18) "Content-Length: 5 " string(1) " " string(6) "klaus " -chuck -- "Regard my poor demoralized mule!" - Juan Valdez