note 56133 rejected from function.socket-read by betz
| From: | betz@php.net | Date: | Fri, 28 Oct 2005 17:07:58 +0000 |
| Subject: | note 56133 rejected from function.socket-read by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-97751@lists.php.net to get a copy of this message | ||
Note Submitter: rathamahata at rathamahata dot net
----
I found very misleading that in non-blocked mode socket_read(... ,... , PHP_NORMAL_READ) is really
blocked from the php developer angle of view.
e.g.
78 socket_set_nonblock($my_socket);
...
303 $read = socket_read($res, 1024, PHP_NORMAL_READ);
produces next stace (in my environment, whether socket:371 is actualy a connect to a server
indefinitely waiting for further input from user).
fcntl64(371, F_GETFL) = 0x802 (flags O_RDWR|O_NONBLOCK)
recv(371, "\30", 1, 0) = 1
recv(371, "\375", 1, 0) = 1
recv(371, "\375", 1, 0) = 1
recv(371, "\375", 1, 0) = 1
recv(371, "\375", 1, 0) = 1
recv(371, " ", 1, 0) = 1
recv(371, "\30"", 1, 0) = 1
recv(371, "\30", 1, 0) = 1
recv(371, "#", 1, 0) = 1
recv(371, "#", 1, 0) = 1
recv(371, "\30", 1, 0) = 1
recv(371, "\'", 1, 0) = 1
recv(371, 0x81cc2d0, 1, 0) = -1 EAGAIN (Resource temporarily unavailable)
recv(371, 0x81cc2d0, 1, 0) = -1 EAGAIN (Resource temporarily unavailable)
recv(371, 0x81cc2d0, 1, 0) = -1 EAGAIN (Resource temporarily unavailable)
recv(371, 0x81cc2d0, 1, 0) = -1 EAGAIN (Resource temporarily unavailable)
recv(371, 0x81cc2d0, 1, 0) = -1 EAGAIN (Resource temporarily unavailable)
recv(371, 0x81cc2d0, 1, 0) = -1 EAGAIN (Resource temporarily unavailable)
recv(371, 0x81cc2d0, 1, 0) = -1 EAGAIN (Resource temporarily unavailable)
recv(371, 0x81cc2d0, 1, 0) = -1 EAGAIN (Resource temporarily unavailable)
recv(371, 0x81cc2d0, 1, 0) = -1 EAGAIN (Resource temporarily unavailable)
recv(371, 0x81cc2d0, 1, 0) = -1 EAGAIN (Resource temporarily unavailable)
recv(371, 0x81cc2d0, 1, 0) = -1 EAGAIN (Resource temporarily unavailable)
recv(371, 0x81cc2d0, 1, 0) = -1 EAGAIN (Resource temporarily unavailable)
....
/* wait for a minutes */
So it seems to me that socket_read(... ,... , PHP_NORMAL_READ) is abandon of the whole idea of the
non-blocked sockets ...
Sergey S. Kostyliov <rathamahata@rathamahata.net>
http://www.rathamahata.net/