*/
} // END - if
- // "Bind" the socket to the given address, on given port so this means
- // that all connections on this port are now our resposibility to
- // send/recv data, disconnect, etc..
- $this->debugOutput('TCP-LISTENER: Binding to address ' . $this->getListenAddress() . ':' . $this->getListenPort());
- if (!socket_bind($mainSocket, $this->getListenAddress(), $this->getListenPort())) {
+ // Now, we want non-blocking mode
+ $this->debugOutput('TCP-LISTENER: Setting non-blocking mode.');
+ if (!socket_set_nonblock($mainSocket)) {
// Handle this socket error with a faked recipientData array
$this->handleSocketError($mainSocket, array('0.0.0.0', '0'));
/*
*/
} // END - if
- // Start listen for connections
- $this->debugOutput('TCP-LISTENER: Listening for connections.');
- if (!socket_listen($mainSocket)) {
+ /*
+ * "Bind" the socket to the given address, on given port so this means
+ * that all connections on this port are now our resposibility to
+ * send/recv data, disconnect, etc..
+ */
+ $this->debugOutput('TCP-LISTENER: Binding to address ' . $this->getListenAddress() . ':' . $this->getListenPort());
+ if (!socket_bind($mainSocket, $this->getListenAddress(), $this->getListenPort())) {
// Handle this socket error with a faked recipientData array
$this->handleSocketError($mainSocket, array('0.0.0.0', '0'));
/*
*/
} // END - if
- // Now, we want non-blocking mode
- $this->debugOutput('TCP-LISTENER: Setting non-blocking mode.');
- if (!socket_set_nonblock($mainSocket)) {
+ // Start listen for connections
+ $this->debugOutput('TCP-LISTENER: Listening for connections.');
+ if (!socket_listen($mainSocket)) {
// Handle this socket error with a faked recipientData array
$this->handleSocketError($mainSocket, array('0.0.0.0', '0'));
/*