// Import application-specific stuff
use Hub\Information\ShareableInfo;
+use Hub\Listener\BaseListener;
use Hub\Network\Package\NetworkPackage;
// Import framework stuff
use CoreFramework\Container\BaseContainer;
use CoreFramework\Listener\Listenable;
use CoreFramework\Registry\Registerable;
+use CoreFramework\Socket\InvalidSocketException;
use CoreFramework\Visitor\Visitable;
use CoreFramework\Visitor\Visitor;
return $isValidSocket;
}
+ /**
+ * Getter for last socket error
+ *
+ * @return $lastSocketError Last socket error
+ */
+ public function getLastSocketError () {
+ // Should be valid socket
+ if (!$this->isValidSocket()) {
+ // Throw exception
+ throw new InvalidSocketException(array($this, $this->getSocketResource()), BaseListener::EXCEPTION_INVALID_SOCKET);
+ } // END - if
+
+ // Get it from stored socket resource
+ $socketResource = $this->getSocketResource();
+
+ // Get error code
+ $errorCode = socket_last_error($socketResource);
+
+ // Return it
+ return $errorCode;
+ }
+
+ /**
+ * Tries to bind the socket.
+ *
+ * @return $result Result from binding socket
+ */
+ public function bindSocketTo () {
+ $this->partialStub('Unfinished method.');
+ }
+
}
$listenerInstance->handleSocketError(__METHOD__, __LINE__, $socketInstance, $packageData);
} // END - if
- // Now, we want non-blocking mode
+ // Allow non-blocking I/O
self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-FILE-LISTENER: Setting non-blocking mode.');
if (!$socketInstance->enableSocketNonBlocking()) {
// Handle this socket error with a faked recipientData array
*/
function isValidSocket ();
+ /**
+ * Getter for last socket error
+ *
+ * @return $lastSocketError Last socket error
+ */
+ function getLastSocketError ();
+
+ /**
+ * Tries to bind the socket.
+ *
+ * @return $result Result from binding socket
+ */
+ function bindSocketTo ();
+
}