// Set the option to reuse the port
$this->debugOutput('UDP-LISTENER: Setting re-use address option.');
if (!socket_set_option($mainSocket, SOL_SOCKET, SO_REUSEADDR, 1)) {
+ // Handle the socket error with a faked recipientData array
+ $this->handleSocketError($mainSocket, array('0.0.0.0', '0'));
+ /*
// Get socket error code for verification
$socketError = socket_last_error($mainSocket);
$this->shutdownSocket($mainSocket);
// And throw again
- throw new InvalidSocketException(array($this, gettype($mainSocket), $socketError, $errorMessage), BaseListener::EXCEPTION_INVALID_SOCKET);
+ throw new InvalidSocketException(array($this, $mainSocket, $socketError, $errorMessage), BaseListener::EXCEPTION_INVALID_SOCKET);
+ */
} // END - if
// "Bind" the socket to the given address, on given port so this means
// send/recv data, disconnect, etc..
$this->debugOutput('UDP-LISTENER: Binding to address ' . $this->getListenAddress() . ':' . $this->getListenPort());
if (!socket_bind($mainSocket, $this->getListenAddress(), $this->getListenPort())) {
+ // Handle the socket error with a faked recipientData array
+ $this->handleSocketError($mainSocket, array('0.0.0.0', '0'));
+ /*
// Get socket error code for verification
$socketError = socket_last_error($mainSocket);
$this->shutdownSocket($mainSocket);
// And throw again
- throw new InvalidSocketException(array($this, gettype($mainSocket), $socketError, $errorMessage), BaseListener::EXCEPTION_INVALID_SOCKET);
+ throw new InvalidSocketException(array($this, $mainSocket, $socketError, $errorMessage), BaseListener::EXCEPTION_INVALID_SOCKET);
+ */
} // END - if
// Now, we want non-blocking mode
$this->debugOutput('UDP-LISTENER: Setting non-blocking mode.');
if (!socket_set_nonblock($mainSocket)) {
+ // Handle the socket error with a faked recipientData array
+ $this->handleSocketError($mainSocket, array('0.0.0.0', '0'));
+ /*
// Get socket error code for verification
$socketError = socket_last_error($socket);
$this->shutdownSocket($mainSocket);
// And throw again
- throw new InvalidSocketException(array($this, gettype($mainSocket), $socketError, $errorMessage), BaseListener::EXCEPTION_INVALID_SOCKET);
+ throw new InvalidSocketException(array($this, $mainSocket, $socketError, $errorMessage), BaseListener::EXCEPTION_INVALID_SOCKET);
+ */
} // END - if
// Remember the socket in our class