php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29726 Streams socket functionality
Submitted: 2004-08-18 00:59 UTC Modified: 2005-02-24 01:00 UTC
From: lists at cyberlot dot net Assigned:
Status: No Feedback Package: Sockets related
PHP Version: 5.0.1 OS: Fedora Core 2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: lists at cyberlot dot net
New email:
PHP Version: OS:

 

 [2004-08-18 00:59 UTC] 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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-18 21:09 UTC] 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-09-10 13:58 UTC] wez@php.net
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.

 [2005-02-24 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Jan 27 20:03:37 2022 UTC