Hi, PHP fails to set the socket_last_error when stream_socket_server() times out.
It is therefore impossible to tell if a timeout occurred or if the call failed for some other reason. Here is a simple piece of that should help understand this issue: <?php // Call something that will set socket_last_error() socket_create(AF_INET, SOCK_STREAM, 666); $err = socket_last_error(); echo 'before: ', socket_strerror($err), "\t", $err, "\n"; // now call stream_socket_accept and timeout $sock = stream_socket_server('tcp://0.0.0.0:0 <http://0.0.0.0:0>'); $client = stream_socket_accept($sock, 1); $err = socket_last_error(); echo 'after: ', socket_strerror($err), "\t", $err, "\n"; PHP currently outputs: before: Protocol not supported 43 after: Protocol not supported 43 I have a patch to fix this issue: http://pastebin.com/6JLjZkNu The output then becomes: before: Protocol not supported 43 after: Operation timed out 60 However the patch adds #include "ext/sockets/php_sockets.h" to ext/standard/streamsfuncs.c. Is that something we are okay living with? Thanks, Alok -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php