Date: 07/12/99
- Next message: Sascha Schumann: "Re: [PHP-DEV] Antwort: Bug #1695 Updated: fgets read to few data (1 byte)"
- Previous message: David Sklar: "Re: [PHP-DEV] gmstrftime"
- Next in thread: Sascha Schumann: "Re: [PHP-DEV] Antwort: Bug #1695 Updated: fgets read to few data (1 byte)"
- Reply: Sascha Schumann: "Re: [PHP-DEV] Antwort: Bug #1695 Updated: fgets read to few data (1 byte)"
- Reply: Rasmus Lerdorf: "Re: [PHP-DEV] Antwort: Bug #1695 Updated: fgets read to few data (1 byte)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello Again,
fgets - bug (reading and writing data from blocket socket without LF and
EOF)
OK, sorry - the problem is more difficult. I am reading and writing binary
data from a socket based server (no LF and no EOF
between the requests). The latest version doing it was php3.0.6. Then we
try php3.0.9 where this application did not work.
Before i try to find out whats going wrong there is php3.0.11 available and
we test it. same problem. Now we have to
read n+1 byte (this has changed) in fgets. This work fine for the first m
requests, but the last request sleep forever. So i start
debugging (its not easy to find a small example to send you). The problem
is the buffered io in blocked sockets. If we want
to read the last x < 512 bytes, from socket and the bytes are always in the
buffer, php try to wait for data with funktion
_php_sock_wait_for_data() !
In funktion _php3_sock_fgets the nr_toread did cause the bug. Firs it try
_php3_sock_read_limited( sock, 0) whitch return zero.
Next it try _php3_sock_read_limited( sock, 512). This end in
_php_sock_wait_for_data(). But all data are available in the buffer and
the server will not send any more bytes!
there is no need for nr_toread. replace line 600 in file functions/fsock.c:
< nr_read += _php3_sock_read_limited( sock, nr_toread);
> nr_read += _php3_sock_read_limited( sock, maxlen);
i am no nativ speaker, but i hope you will understand the problem. If not,
i try to make a sample.
Andreas
(Embedded
image moved Bug Database <php-dev <email protected>>
to file: 12.07.99 08:43
pic23645.pcx)
An: andreas rieber
Kopie:
Thema: Bug #1695 Updated: fgets read to few data (1 byte)
ID: 1695
Updated by: sas
Reported By: andreas.rieber <email protected>
Status: Closed
Bug Type: Other
Assigned To:
Comments:
The observed behaviour is correct. From the Single Unix Specification:
char *fgets(char *s, int n, FILE *stream);
The fgets() function reads bytes from stream into the array pointed to by
s, until n-1 bytes are read, or a newline character is read and transferred
to s, or an end-of-file condition is encountered. The string is then
terminated with a null byte.
Full Bug description available at: http://bugs.php.net/?id=1695
- application/octet-stream attachment: pic23645.pcx
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Sascha Schumann: "Re: [PHP-DEV] Antwort: Bug #1695 Updated: fgets read to few data (1 byte)"
- Previous message: David Sklar: "Re: [PHP-DEV] gmstrftime"
- Next in thread: Sascha Schumann: "Re: [PHP-DEV] Antwort: Bug #1695 Updated: fgets read to few data (1 byte)"
- Reply: Sascha Schumann: "Re: [PHP-DEV] Antwort: Bug #1695 Updated: fgets read to few data (1 byte)"
- Reply: Rasmus Lerdorf: "Re: [PHP-DEV] Antwort: Bug #1695 Updated: fgets read to few data (1 byte)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

