Open igorw opened 11 years ago
There's a workaround even without the need for reactphp/react#113: you set the STREAM_CLIENT_ASYNC_CONNECT
flag and subscribe for a write event on the connecting stream, if stream_socket_get_name($socket, true) === false
when the write event kicks then it means that the connection has been refused.
I do that in Predis\Async and it seems to work quite well, see here and here for the related code.
That's quite nice, ideally we would have something for that in react core.
Currently the connect call itself is blocking.
We should call
stream_socket_client
with theSTREAM_CLIENT_ASYNC_CONNECT
flag. But that means we cannot tell connection failure at connect time.We can only detect connection failure if we have reactphp/react#113. So that needs to be fixed first.