php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15430 socket_set_blocking doesn't work
Submitted: 2002-02-07 09:43 UTC Modified: 2002-06-18 19:18 UTC
Votes:8
Avg. Score:4.8 ± 0.4
Reproduced:7 of 8 (87.5%)
Same Version:7 (100.0%)
Same OS:5 (71.4%)
From: armageddon at raydan dot de Assigned:
Status: Closed Package: Sockets related
PHP Version: 4.1.1 OS: Windows 2000
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
37 + 22 = ?
Subscribe to this entry?

 
 [2002-02-07 09:43 UTC] armageddon at raydan dot de
I'm using Apache1.3.22/PHP4.1.1 on Windows 2000.

When I use socket_set_blocking($fp, FALSE); PHP doesn't read any more data from the socket:

...
do {
  if ($ch=fgetc($fp))
    echo dechex(ord($ch))." ";
  ...
  if ($ch==chr(0x2A)) {
    ...
  }
  sleep(1);
  ...
} while (1);
...

This does work with socket blocking enabled but with socket blocking disabled I don't get any more data in my PHP-Script !

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-14 08:09 UTC] ruehl at igd dot fhg dot de
I have currently the same problem with PHP 4.1.1. However, when I put the sleep(1) statement IN FRONT of the fgets() or fgetc(), my code works even with non-blocking sockets (it's annoying but it works). Maybe this helps you for now (until this bug has been fixed).
 [2002-04-06 15:05 UTC] armageddon at raydan dot de
Re: ruehl@igd.fhg.de 

This doesn't work for me :-(
I still don't get any date when I use non-blocking sockets...
 [2002-06-08 06:44 UTC] bool at boolsite dot net
It's work for me, but it leaks memory... :o(

The problem is analysed actually... :o)
 [2002-06-08 06:55 UTC] mfischer@php.net
Wierd duplicate of http://bugs.php.net/?id=15485&edit=1
 [2002-06-08 07:10 UTC] armageddon at raydan dot de
Why "Duplicate" ? The other report is about a memory leak and mine is about PHP doesn't read data from the socket when using non-blocking sockets.
 [2002-06-18 19:18 UTC] sniper@php.net
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version at http://snaps.php.net/. In case this was a documentation 
problem, the fix will show up soon at http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites.
Thank you for the report, and for helping us make PHP better.


 [2002-07-21 15:13 UTC] on4kst at skynet dot be
In despite of this bug is closed the socket_set_blocking($fp, FALSE) function does not work as reported by armageddon@raydan.de. Tested on Windows XP / Apache / PHP 4.0.6 and PHP 4.2.0. Used with fsockopen and fgets the behaviour in correct when the value is set to TRUE. When FALSE, a fgets() function always returns an empty string EVEN IF A DATA IS PENDING. In other words fgets() stops to read data.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Aug 15 06:05:46 2022 UTC