Bug #55814 [Opn->Asn]: stream_socket_recvfrom() ârandomlyâ returns false
Edit report at https://bugs.php.net/bug.php?id=55814&edit=1
ID: 55814
Updated by: pajoye@php.net
Reported by: ivan dot enderlin at hoa-project dot net
Summary: stream_socket_recvfrom() ârandomlyâ returns
false
-Status: Open
+Status: Assigned
Type: Bug
Package: Streams related
Operating System: Windows 7
PHP Version: Irrelevant
-Assigned To:
+Assigned To: mattficken
Block user comment: N
Private report: N
New Comment:
Matt, please analyze that one.
Previous Comments:
------------------------------------------------------------------------
[2011-09-29 14:23:07] ivan dot enderlin at hoa-project dot net
Description:
------------
Sometimes, on Windows7 with PHP5.3+, stream_socket_recvfrom() returns false (the documentation says
that it always returns a string but the source code says the opposite, it can return false), and I
have no idea why. It happens only on Windows7 a priori. Basically, I have a client and a server as
bellow.
Test script:
---------------
Client.php
<?php
$client = stream_socket_client(
'tcp://127.0.0.1:9001',
$errno,
$errstr,
30,
STREAM_CLIENT_CONNECT
);
echo 'Received ';
var_dump(stream_socket_recvfrom($client, 6));
Server.php
<?php
$server = stream_socket_server(
'tcp://127.0.0.1:9001',
$errno,
$errstr,
STREAM_SERVER_BIND | STREAM_SERVER_LISTEN
);
echo 'Up & listenâ¦', "\n";
$client = stream_socket_accept($server);
echo 'New connection', "\n";
stream_socket_sendto($client, 'foobar');
echo 'Sent âfoobarâ', "\n";
Expected result:
----------------
Client.php
Received: string(6) "foobar"
Server.php
Up & listenâ¦
New connection
Sent âfoobarâ
Actual result:
--------------
Client.php
Sometimes: Received: string(6) "foobar"
Sometimes: Received: bool(false)
Server.php
Up & listenâ¦
New connection
Sent âfoobarâ
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55814&edit=1
Thread (5 messages)