// Get socket error code for verification
$socketError = socket_last_error($mainSocket);
+ // Get error message
+ $errorMessage = socket_strerror($socketError);
+
+ // Shutdown this socket
+ $this->shutdownSocket($mainSocket);
+
// And throw again
- throw new InvalidSocketException(array($this, gettype($mainSocket), $socketError, socket_strerror($socketError)), BaseListener::EXCEPTION_INVALID_SOCKET);
+ throw new InvalidSocketException(array($this, gettype($mainSocket), $socketError, $errorMessage), BaseListener::EXCEPTION_INVALID_SOCKET);
} // END - if
// "Bind" the socket to the given address, on given port so this means
// Get socket error code for verification
$socketError = socket_last_error($mainSocket);
+ // Get error message
+ $errorMessage = socket_strerror($socketError);
+
+ // Shutdown this socket
+ $this->shutdownSocket($mainSocket);
+
// And throw again
- throw new InvalidSocketException(array($this, gettype($mainSocket), $socketError, socket_strerror($socketError)), BaseListener::EXCEPTION_INVALID_SOCKET);
+ throw new InvalidSocketException(array($this, gettype($mainSocket), $socketError, $errorMessage), BaseListener::EXCEPTION_INVALID_SOCKET);
} // END - if
// Start listen for connections
// Get socket error code for verification
$socketError = socket_last_error($mainSocket);
+ // Get error message
+ $errorMessage = socket_strerror($socketError);
+
+ // Shutdown this socket
+ $this->shutdownSocket($mainSocket);
+
// And throw again
- throw new InvalidSocketException(array($this, gettype($mainSocket), $socketError, socket_strerror($socketError)), BaseListener::EXCEPTION_INVALID_SOCKET);
+ throw new InvalidSocketException(array($this, gettype($mainSocket), $socketError, $errorMessage), BaseListener::EXCEPTION_INVALID_SOCKET);
} // END - if
// Set the main socket
// Is it without any errors?
if ($errorCode > 0) {
- // Throw an exception again
- throw new InvalidSocketException(array($this, gettype($socketResource), $errorCode, socket_strerror($errorCode)), BaseListener::EXCEPTION_INVALID_SOCKET);
+ // Get error message
+ $errorMessage = socket_strerror($errorCode);
+
+ // Shutdown this socket
+ $this->getListenerInstance()->shutdownSocket($mainSocket);
+
+ // And throw again
+ throw new InvalidSocketException(array($this, gettype($mainSocket), $socketError, $errorMessage), BaseListener::EXCEPTION_INVALID_SOCKET);
} // END - if
// Add it finally to the pool