note 56133 added to function.socket-read
| From: | rathamahata at rathamahata dot net | Date: | Wed, 24 Aug 2005 15:58:39 +0000 |
| Subject: | note 56133 added to function.socket-read | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-94136@lists.php.net to get a copy of this message | ||
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/
----
Manual Page -- http://www.php.net/manual/en/function.socket-read.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+56133
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56133&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56133&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56133&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56133&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56133&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56133&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+56133&report=yes
Search -- http://master.php.net/manage/user-notes.php