php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1739 fread() hangs while trying to read from a socket
Submitted: 1999-07-19 22:20 UTC Modified: 1999-07-21 04:23 UTC
From: danbeck at scott dot net Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0 Latest CVS (19/07/1999) OS: Linux 2.0.32 (RedHat 5.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: danbeck at scott dot net
New email:
PHP Version: OS:

 

 [1999-07-19 22:20 UTC] danbeck at scott dot net
This problem has existed since about 3.0.9.  It's supposedly been fixed in one way or another, but it keeps cropping up... consistantly.  What I'm doing is attempting to read data from a socket using the following methodology:

while (!feof($this->socket)){
    $buffer .= fread( $this->socket, 1);
}

What happens is that php hangs for exactly 16 seconds every single time.

Even if I just do a:

$buffer = fread( $this->socket, 1024); 

it also hangs for the same amount of time.

But... if I try to read a number of bytes less than or equal to the number of bytes available, it returns instantly with the data from the socket:

$buffer = fread( $this->socket, 2);




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-07-21 04:23 UTC] sas at cvs dot php dot net
When the receive queue is empty and you do a blocking read, it will block. That's how it works.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 17 01:01:32 2024 UTC