Non-blocking sockets
| From: | Eric | Date: | Fri, 27 Oct 2006 21:23:24 +0000 |
| Subject: | Non-blocking sockets | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-243772@lists.php.net to get a copy of this message | ||
When I create a socket/stream that connects to a news sever and try to recv data from the socket when there is nothing there (Like if the server sends one line and I call recv twice) the socket freezes. I assume this is because using socket_create or fsockopen creates a blocking TCP/Stream socket by default. When I call socket_set_nonblock() and the socket_connect I get "A non-blocking operation could not be completed immediately". Could someone show me exactly how to create a non-blocking TCP/Stream socket? Thanks in advance.