Re: Fixing socket reads
| From: | Sascha Schumann | Date: | Fri, 04 Oct 2002 14:45:48 +0000 |
| Subject: | Re: Fixing socket reads | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-89007@lists.php.net to get a copy of this message | ||
Here is a second patch, with a third coming some time later.
The current stream implementation does not consume its
buffered data before starting new reads. That causes serious
problems with sockets, of course, if you have an application
which exchanges commands/replies with a server. The
stream_gets function reads many lines, returns a single one,
and then tries to read from the network again.
The patch changes the semantic: Consume the buffer first,
then call the stream read op.
My fgets-based pop3 reader works with this patch already. I
suspect that fread exposes similar problems though, but I
don't have time right now to improve it similarly.
- Sascha