I programmed a server to bind to an external server(Let's call it C-server). My server will have to listen on the connection to C-server and send over data frequently. Each write of data to C-server from my server will cause C-server to response a string.
So the codes will be something like this:
if($response) { socket_write($read_socket, "$response", strlen($response)); echo $response."\n"; } ... some processing to construct string to be send over ... foreach($message as $part) { socket_write($this->c_socket, $part); echo $part."\n"; $out = socket_read($this->c_socket, 1024); echo $out."\n"; error_log($part.":".$out."\n", 3, $this->logfile); }
Everytime the execution reaches socket_write($this->c_socket, $part); a php warning is issued
<br />
<b>Warning</b>: socket_read() unable to read from socket [11]: Resource temporarily unavailable in <b>/var/www/html/dreamscape_mg/connectors/celcom/mo.php</b> on line <b>134</b><br />
Line 134 is the curl brace after the foreach. I am assuming that the socket read would be $out = socket_read($this->c_socket, $part). Why do I get the warning? c_socket is non blocking.
Thanks for your help Ai Leen
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php