This makes me nuts. I have to create a very simple non-blocking socket script in php 5.3 where a client connects to a server, both using non-blocking sockets.
I've tried phpsocketdaemon and the example from the php manual, but in both cases when I try to connect to the server I get the following error:
socket_connect() [function.socket-connect]: unable to connect [10035]:
A non-blocking socket operation could not be completed immediately
My client script where the error happens:
$service_port = 2002;
$address = '127.0.0.1';
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_set_nonblock($socket);
$result = socket_connect($socket, $address, $service_port);
...
I'm using the free version of Zend Server 5.6.0 SP1 on Win 7.
Does anyone know how to fix this problem or know a simple and understandable example of a non-blocking socket client/server script?