Jump to content

Non-blocking sockets


LimpCheese

Recommended Posts

Can someone show me an example of how to create a non-blocking socket for a SOCKET_STREAM over tcp. When I use the following code I get "A non-blocking operation could not be completed immediately." error. Thank in advance.

[code]
        $socket = socket_create(AF_INET, SOCK_RAW, SOL_TCP);
socket_set_nonblock($socket);
socket_connect($socket,"news.csh.rit.edu",119); //ERROR OCCURS ON THIS LINE
socket_recv($socket,$buf,1024,0);
echo $buf;
[/code]
Link to comment
https://forums.phpfreaks.com/topic/25327-non-blocking-sockets/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.