ID:               29726
 Updated by:       [EMAIL PROTECTED]
 Reported By:      lists at cyberlot dot net
 Status:           Open
 Bug Type:         Sockets related
 Operating System: Fedora Core 2
 PHP Version:      5.0.1
 New Comment:

Please be more specific in what the problem is.
Note:

- PHP fgets() is line based and binary safe, changing it would break
things.  It only returns lines, or the last partial line before the
socket (or file) is closed.

- If you want to break lines on multiple different characters, you need
to code your own buffer handling yourself.  See stream_socket_select()
for a way to avoid blocking and writing multiplexing socket servers.



Previous Comments:
------------------------------------------------------------------------

[2004-08-18 21:09:35] lists at cyberlot dot net

This problem only exists with fread, fget which multiple examples in
the docs use and the docs list as "See Also" functions.

However by using stream_socket_recvfrom this problem was resovled..
This function is not at this time referenced in the manual other in the
functions list so might easily overlooked as I did.

One possible issue I do see, stream_socket_recvfrom looks to work
because it pulls everything in the buffer up to X bytes regardless of
any EOL character. On a slow single line entry settup this shouldn't be
a problem and everything should work fine..

Under high load when data ends up being buffered at both sides this
function would return only partial "blocks" of what a user might expect
and the user would need to program his own internal buffering that
checks for EOL.

This should be covered in more detail in the online manual.

------------------------------------------------------------------------

[2004-08-18 00:59:26] lists at cyberlot dot net

Description:
------------
switched from socket functions to stream functions for socket server
usage because streams is supposed to be stable, and are included by
default.. 

The problem socket_read supports  PHP_NORMAL_READ which allows it to
see flashes \0 as EOL...

This is not possible when using streams to create a socket server as
fget does not see \0 as EOL

Expected result:
----------------
Expect fgets to return data at \0

Actual result:
--------------
Nothing is returned until the buffer is filled.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=29726&edit=1

Reply via email to