|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-07-15 13:06 UTC] jani@php.net
[2008-07-15 15:20 UTC] rbarnes at aethon dot com
[2008-07-15 17:16 UTC] jani@php.net
[2008-07-15 17:49 UTC] rbarnes at aethon dot com
[2008-07-15 20:52 UTC] jani@php.net
[2008-07-23 01:00 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 29 18:00:01 2025 UTC |
Description: ------------ I'm trying to implement a non-blocking connect similar to the one in Steven's "Unix Network Programming" on pg 450. I create the socket, set it to non-blocking and call connect which of course returns immediately with a SOCKET_EINPROGRESS error ( as expected ). Then I call socket_select with a timeout greater than 0 and socket_select returns immediately, even though the socket's state is still SOCKET_EINPROGRESS. errno 115: Operation now in progress Reproduce code: --------------- function ConnectSocket($remote, $port) { $sock = NULL; if (!($sock = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP))) return NULL; socket_set_nonblock($sock); if (!@socket_connect($sock, $remote, $port+0)) { if (socket_select($rin = array($sock), $win = $rin, $ein = NULL, 30.0) < 1) return NULL; if (socket_recv($sock, $buf, 0, 0) === false) { print socket_strerror(socket_last_error()) . "\n"; return NULL; } } socket_set_block($sock); return $sock; } ConnectSocket('206.190.60.37', 80); Expected result: ---------------- socket_select should block until either the connection completes or the timeout is exceeded. Actual result: -------------- socket_select returns immediately. SOCKET_EINPROGRESS Operation now in progress