ID: 27211
Updated by: [EMAIL PROTECTED]
Reported By: glox at glox dot be
-Status: Open
+Status: Verified
Bug Type: Sockets related
Operating System: *
PHP Version: 5CVS-2004-02-12
Previous Comments:
------------------------------------------------------------------------
[2004-02-12 14:27:50] glox at glox dot be
Well the server script is copy pasted from the manual page.
So, or the example is wrong, or there is a bug with those functions.
------------------------------------------------------------------------
[2004-02-11 15:43:55] [EMAIL PROTECTED]
I'm not sure if it's actually a bug..(just read the manual page for
these funcs, never used them myself before :)
stream_socket_accept() also crashes, if you happen to use the 3rd
parameter too..
------------------------------------------------------------------------
[2004-02-10 14:28:51] glox at glox dot be
Description:
------------
stream_socket_accept() returns the following error with the example
from the manual page:
Warning: stream_socket_accept(): accept failed: Invalid argument in
/share/wolfd/serv.php on line 6
I'm running this on freeBSD 5.1 with the latest php snapshot at this
moment.
Reproduce code:
---------------
Server:
<?php
$socket = stream_socket_server("udp://0.0.0.0:13", $errno, $errstr,
STREAM_SERVER_BIND);
if (!$socket) {
echo "ERROR: $errno - $errstr<br />\n";
} else {
while ($conn = stream_socket_accept($socket)) {
fwrite($conn, date("D M j H:i:s Y\r\n"));
fclose($conn);
}
fclose($socket);
}
?>
Client:
<?php
$sock = stream_socket_client('udp://127.0.0.1:13');
fwrite($sock, "a\n"); //if I don't add this nothing happens
$get = fgets($sock);
echo $get;
fclose($sock);
?>
Expected result:
----------------
The connection to the client should open, it should send the time and
close.
Actual result:
--------------
Warning: stream_socket_accept(): accept failed: Invalid argument in
/share/wolfd/serv.php on line 6
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=27211&edit=1