note 115047 added to function.socket-accept
| From: | mightyplow at gmail dot com | Date: | Sun, 18 May 2014 14:47:32 +0000 |
| Subject: | note 115047 added to function.socket-accept | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-199558@lists.php.net to get a copy of this message | ||
In order to make many clients connectable to the server, you have to set the accepted socket also to
non-blocking. Otherwise the accepted connection will block further incoming connections.
while (true) {
$newSock = @socket_accept($sock);
if ($newSock) {
echo 'client connected';
socket_set_nonblock($newSock);
}
}
----
Server IP: 72.52.91.14
Probable Submitter: 95.91.220.37
----
Manual Page -- http://php.net/manual/en/function.socket-accept.php
Edit -- https://master.php.net/note/edit/115047
Del: integrated -- https://master.php.net/note/delete/115047/integrated
Del: useless -- https://master.php.net/note/delete/115047/useless
Del: bad code -- https://master.php.net/note/delete/115047/bad+code
Del: spam -- https://master.php.net/note/delete/115047/spam
Del: non-english -- https://master.php.net/note/delete/115047/non-english
Del: in docs -- https://master.php.net/note/delete/115047/in+docs
Del: other reasons-- https://master.php.net/note/delete/115047
Reject -- https://master.php.net/note/reject/115047
Search -- https://master.php.net/manage/user-notes.php