socket_connect() unable to connect [115]: Operation now in progress
| From: | Paul McGarry | Date: | Mon, 11 Apr 2011 05:57:44 +0000 |
| Subject: | socket_connect() unable to connect [115]: Operation now in progress | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-312327@lists.php.net to get a copy of this message | ||
Hi all,
Can anyone explain why I might get a:
socket_connect(): unable to connect [115]: Operation now in progress
error on a blocking socket?
The documentation seems to suggest that is a 'normal' response for a
non-blocking socket but I am seeing it on a blocking socket.
Example code:
====
$this->logSocket = socket_create ( AF_INET,
SOCK_STREAM, SOL_TCP );
socket_set_block($this->logSocket);
socket_set_option ( $this->logSocket, SOL_SOCKET,
SO_SNDTIMEO, array ('sec' => 2, "usec" => 0 ) );
$this->loggerConnected = socket_connect (
$this->logSocket, $this->logHost, $this->logPort );
if (! $this->loggerConnected)
user_error ( 'Error connecting to ' .
$this->logHost . ' ' . $this->logPort );
====
The port it is connecting to is running on localhost. It works roughly
99.9% of the time but occasionally fails with the error above.
Paul