From:             glox at glox dot be
Operating system: freeBSD 5.1
PHP version:      5CVS-2004-02-10 (dev)
PHP Bug Type:     Sockets related
Bug description:  stream_socket_accept() returns Invalid argument

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 bug report at http://bugs.php.net/?id=27211&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=27211&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=27211&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=27211&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=27211&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=27211&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=27211&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=27211&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=27211&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=27211&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=27211&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=27211&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=27211&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27211&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=27211&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=27211&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=27211&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27211&r=float

Reply via email to