note 103998 rejected from function.socket-accept by danbrown
| From: | danbrown@php.net | Date: | Mon, 16 May 2011 16:08:32 +0000 |
| Subject: | note 103998 rejected from function.socket-accept by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-179762@lists.php.net to get a copy of this message | ||
Note Submitter: degreane at gmail dot com
----
I tried the example given
#!/usr/bin/env php
<?php
$port=8888;
$clients = array();
$socket = socket_create(AF_INET,SOCK_STREAM,SOL_TCP);
socket_bind($socket,'127.0.0.1',$port);
socket_listen($socket);
socket_set_nonblock($socket);
while(true)
{
if(($newc = socket_accept($socket)) !== false)
{
echo "Client $newc has connected\n";
$clients[] = $newc;
}
}
?>
and i got the following error
PHP Warning: socket_accept(): unable to accept incoming connection [11]: Resource temporarily
unavailable in /home/faysal/Ady/AdyTest.php on line 13
PHP Stack trace:
PHP 1. {main}() /home/faysal/Ady/AdyTest.php:0
PHP 2. socket_accept() /home/faysal/Ady/AdyTest.php:13
PHP Warning: socket_accept(): unable to accept incoming connection [11]: Resource temporarily
unavailable in /home/faysal/Ady/AdyTest.php on line 13^