]> git.mxchange.org Git - hub.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sun, 21 May 2017 13:05:48 +0000 (15:05 +0200)
committerRoland Häder <roland@mxchange.org>
Fri, 21 Aug 2020 16:50:05 +0000 (18:50 +0200)
- implemented clearLastSocketError()
- renamed variables
- removed duplicate field, now handled by any StorableSocket class
- more fixes

Signed-off-by: Roland Häder <roland@mxchange.org>
13 files changed:
application/hub/classes/container/socket/class_SocketContainer.php
application/hub/classes/discovery/recipient/socket/class_PackageSocketDiscovery.php
application/hub/classes/factories/socket/class_SocketFactory.php
application/hub/classes/handler/network/socket/class_SocketRawDataHandler.php
application/hub/classes/handler/network/tcp/class_TcpRawDataHandler.php
application/hub/classes/handler/raw_data/network/class_
application/hub/classes/listener/class_BaseListener.php
application/hub/classes/listener/socket/class_SocketFileListener.php
application/hub/classes/package/class_NetworkPackage.php
application/hub/classes/registry/socket/class_SocketRegistry.php
application/hub/exceptions/socket/class_SocketShutdownException.php
application/hub/interfaces/container/socket/class_StorableSocket.php
application/hub/interfaces/registry/socket/class_RegisterableSocket.php

index 1ae9936a26a155bfe0a4837d54e36174094e1d3d..9197e73b19e1f17388c15d2df358c6473a904318 100644 (file)
@@ -174,6 +174,9 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable
                // Check it
                $isServerSocket = (($this->isValidSocket()) && ($this->getSocketPeerName($peerAddress, $peerPort) === FALSE));
 
+               // Debug message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: isServerSocket=%d', strtoupper($this->getSocketProtocol()), intval($isServerSocket)));
+
                // Need to clear the error here if it is a resource
                if ($isServerSocket === true) {
                        // Clear the error
@@ -182,10 +185,10 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable
                } // END - if
 
                // Debug message
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf(strtoupper($this->getSocketProtocol()) . '-SOCKET: peerAddress=%s,peerPort=%d', $peerAddress, $peerPort));
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: peerAddress=%s,peerPort=%d', strtoupper($this->getSocketProtocol()), $peerAddress, $peerPort));
 
                // Check peer name, it must be empty
-               $isServerSocket = (($isServerSocket) && (empty($peerAddress)));
+               // @TODO: $isServerSocket = (($isServerSocket) && ($peerAddress === '0.0.0.0') && ($peerPort === '0'));
 
                // Trace message
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf(strtoupper($this->getSocketProtocol()) . '-SOCKET: isServerSocket=%d - EXIT!', intval($isServerSocket)));
@@ -260,6 +263,9 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable
         * @throws      InvalidSocketException  If socket is invalid
         */
        public function getSocketPeerName (&$peerAddress, &$peerPort) {
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: peerAddress=%s,peerPort=%d - CALLED!', strtoupper($this->getSocketProtocol()), $peerAddress, $peerPort));
+
                // Should be valid socket
                if (!$this->isValidSocket()) {
                        // Throw exception
@@ -274,7 +280,7 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable
                 * support socket_getpeername():
                 * http://de2.php.net/manual/en/function.socket-getpeername.php#35656
                 */
-               if ($this->getSocketType() == 'udp') {
+               if ($this->getSocketProtocol() == 'udp') {
                        // UDP is WIP:
                        $this->partialStub('UDP sockets are unfinished.');
                } else {
@@ -282,6 +288,9 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable
                        $result = socket_getpeername($this->getSocketResource(), $peerAddress, $peerPort);
                }
 
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: peerAddress=%s,peerPort=%d,result[%s]=%d - EXIT!', strtoupper($this->getSocketProtocol()), $peerAddress, $peerPort, gettype($result), intval($result)));
+
                // Return result
                return $result;
        }
@@ -296,38 +305,6 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable
                return $this->socketProtocol;
        }
 
-       /**
-        * Some "getter" for socket type of stored socket
-        *
-        * @return      $socketType             Socket type
-        * @throws      InvalidSocketException  If socket is invalid
-        */
-       public function getSocketType () {
-               // Should be valid socket
-               if (!$this->isValidSocket()) {
-                       // Throw exception
-                       throw new InvalidSocketException(array($this, $this->getSocketResource()), self::EXCEPTION_INVALID_SOCKET);
-               } // END - if
-
-               // Get socket protocol first
-               $socketProtocol = $this->getSocketProtocol();
-
-               // Debug message
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf(strtoupper($this->getSocketProtocol()) . '-SOCKET: socketProtocol[%s]=%s', gettype($socketProtocol), $socketProtocol));
-
-               // Get socket option
-               $socketType = socket_get_option($this->getSocketResource(), getprotobyname($socketProtocol), SO_TYPE);
-
-               // Debug message
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf(strtoupper($this->getSocketProtocol()) . '-SOCKET: socketType[%s]=%s', gettype($socketType), $socketType));
-
-               // Is it valid?
-               if ($socketType === FALSE) {
-                       // Something went wrong
-                       $this->handleSocketError(__METHOD__, __LINE__, array('null', '0'));
-               } // END - if
-       }
-
        /**
         * Validates stored stocket
         *
@@ -346,12 +323,12 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable
        }
 
        /**
-        * Getter for last socket error
+        * Getter for last socket error code
         *
-        * @return      $lastSocketError        Last socket error
+        * @return      $errorCode      Last socket error
         * @throws      InvalidSocketException  If socket is invalid
         */
-       public function getLastSocketError () {
+       public function getLastSocketErrorCode () {
                // Should be valid socket
                if (!$this->isValidSocket()) {
                        // Throw exception
@@ -371,7 +348,7 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable
        /**
         * Getter for last socket error message
         *
-        * @return      $lastSocketErrorMessage Last socket error message
+        * @return      $errorMessage           Last socket error message
         * @throws      InvalidSocketException  If socket is invalid
         */
        public function getLastSocketErrorMessage () {
@@ -385,10 +362,10 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable
                $socketResource = $this->getSocketResource();
 
                // Get error code and message
-               $message = socket_strerror(socket_last_error($socketResource));
+               $errorMessage = socket_strerror(socket_last_error($socketResource));
 
                // Return it
-               return $message;
+               return $errorMessage;
        }
 
        /**
@@ -463,7 +440,7 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable
         */
        public function doShutdown () {
                // Debug message
-               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HELPER: Shutting down socket ' . $this->getSocketResource());
+               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getSocketProtocol()) . '-SOCKET: Shutting down socket ' . $this->getSocketResource());
                $this->partialStub('Please rewrite this method.');
                return;
 
@@ -508,7 +485,7 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable
         */
        public final function handleSocketError ($method, $line, array $socketData) {
                // Trace message
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('HUB-SYSTEM: Handling socket errorCode=%d - CALLED!', $this->getLastSocketError()));
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('HUB-SYSTEM: Handling socket errorCode=%d - CALLED!', $this->getLastSocketErrorCode()));
 
                // This method handles only socket resources
                if (!$this->isValidSocket()) {
@@ -522,7 +499,7 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable
                assert(isset($socketData[1]));
 
                // Get error code for first validation (0 is not an error)
-               $errorCode = $this->getLastSocketError();
+               $errorCode = $this->getLastSocketErrorCode();
 
                // If the error code is zero, someone called this method without an error
                if ($errorCode == 0) {
@@ -576,7 +553,7 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable
         */
        protected function handleSocketErrorPermissionDenied (array $socketData) {
                // Get socket error code for verification
-               $socketError = $this->getLastSocketError();
+               $socketError = $this->getLastSocketErrorCode();
 
                // Get error message
                $errorMessage = $this->getLastSocketErrorMessage();
@@ -598,7 +575,7 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable
         */
        protected function handleSocketErrorConnectionTimedOut (array $socketData) {
                // Get socket error code for verification
-               $socketError = $this->getLastSocketError();
+               $socketError = $this->getLastSocketErrorCode();
 
                // Get error message
                $errorMessage = $this->getLastSocketErrorMessage();
@@ -620,7 +597,7 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable
         */
        protected function handleSocketErrorResourceUnavailable (array $socketData) {
                // Get socket error code for verification
-               $socketError = $this->getLastSocketError();
+               $socketError = $this->getLastSocketErrorCode();
 
                // Get error message
                $errorMessage = $this->getLastSocketErrorMessage();
@@ -642,7 +619,7 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable
         */
        protected function handleSocketErrorConnectionRefused (array $socketData) {
                // Get socket error code for verification
-               $socketError = $this->getLastSocketError();
+               $socketError = $this->getLastSocketErrorCode();
 
                // Get error message
                $errorMessage = $this->getLastSocketErrorMessage();
@@ -664,7 +641,7 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable
         */
        protected function handleSocketErrorNoRouteToHost (array $socketData) {
                // Get socket error code for verification
-               $socketError = $this->getLastSocketError();
+               $socketError = $this->getLastSocketErrorCode();
 
                // Get error message
                $errorMessage = $this->getLastSocketErrorMessage();
@@ -687,7 +664,7 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable
         */
        protected function handleSocketErrorOperationAlreadyProgress (array $socketData) {
                // Get socket error code for verification
-               $socketError = $this->getLastSocketError();
+               $socketError = $this->getLastSocketErrorCode();
 
                // Get error message
                $errorMessage = $this->getLastSocketErrorMessage();
@@ -709,7 +686,7 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable
         */
        protected function handleSocketErrorConnectionResetByPeer (array $socketData) {
                // Get socket error code for verification
-               $socketError = $this->getLastSocketError();
+               $socketError = $this->getLastSocketErrorCode();
 
                // Get error message
                $errorMessage = $this->getLastSocketErrorMessage();
@@ -731,7 +708,7 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable
         */
        protected function handleSocketErrorOperationNotSupported (array $socketData) {
                // Get socket error code for verification
-               $socketError = $this->getLastSocketError();
+               $socketError = $this->getLastSocketErrorCode();
 
                // Get error message
                $errorMessage = $this->getLastSocketErrorMessage();
@@ -751,7 +728,7 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable
         * @return      void
         */
        protected function handleSocketErrorOperationInProgress (array $socketData) {
-               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: Operation is now in progress, this is usual for non-blocking connections and is no bug.');
+               self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getSocketProtocol()) . '-HELPER: Operation is now in progress, this is usual for non-blocking connections and is no bug.');
        }
 
        /************************************************************************
@@ -843,4 +820,31 @@ class SocketContainer extends BaseContainer implements StorableSocket, Visitable
                $this->socketProtocol = $socketProtocol;
        }
 
+       /**
+        * Clears last socket error
+        *
+        * @return      void
+        * @throws      InvalidSocketException  If stored socket is invalid
+        * @throws      BadMethodCallException  If no socket error was reported but method called
+        */
+       private function clearLastSocketError () {
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getSocketProtocol()) . '-SOCKET: Clearing socket error - CALLED!');
+
+               // Should be valid socket
+               if (!$this->isValidSocket()) {
+                       // Throw exception
+                       throw new InvalidSocketException(array($this, $this->getSocketResource()), self::EXCEPTION_INVALID_SOCKET);
+               } elseif ($this->getLastSocketErrorCode() === 0) {
+                       // Nothing to clear
+                       throw new BadMethodCallException(sprintf('Socket "%s" has no error reported, but method is called.', $this->getSocketResource()));
+               }
+
+               // Clear last error
+               socket_clear_error($this->getSocketResource());
+
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(strtoupper($this->getSocketProtocol()) . '-SOCKET: Error cleared - EXIT!');
+       }
+
 }
index 4a57ec5e4811526ed2b86aefdc5673467c87b04d..22eb61829c123e4dac8819b4994a3afc22e0cfa4 100644 (file)
@@ -177,7 +177,7 @@ class PackageSocketDiscovery extends BaseRecipientDiscovery implements Discovera
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SOCKET-DISCOVERY: socketInstance[]=%s', gettype($socketInstance)));
 
                // Is it FALSE, the recipient isn't known to us and we have no connection to it
-               if (($socketInstance instanceof StorableSocket) || (!$socketInstance->isValidSocket()) || ($socketInstance->getLastSocketError() > 0)) {
+               if (($socketInstance instanceof StorableSocket) || (!$socketInstance->isValidSocket()) || ($socketInstance->getLastSocketErrorCode() > 0)) {
                        // Try to create a new socket resource
                        try {
                                // Possibly noisy debug message
index df5577c58e1d9945348ccb1e5c7ca083428909a1..4bec13a894db19b45f04ac3300b24af78b21d353 100644 (file)
@@ -134,7 +134,7 @@ class SocketFactory extends ObjectFactory {
                } // END - if
 
                // Get socket error code for verification
-               $socketError = $socketInstance->getLastSocketError();
+               $socketError = $socketInstance->getLastSocketErrorCode();
 
                // Check if there was an error else
                if ($socketError > 0) {
@@ -212,7 +212,7 @@ class SocketFactory extends ObjectFactory {
                } // END - if
 
                // Get socket error code for verification
-               $socketError = $socketInstance->getLastSocketError();
+               $socketError = $socketInstance->getLastSocketErrorCode();
 
                // Check if there was an error else
                if ($socketError > 0) {
index 8ff54d60b8d19537718a8a6dd16e9bb1aeff2c23..f60eba73e3c9835dd8528ddf5bc36280398c2917 100644 (file)
@@ -29,11 +29,6 @@ use Hub\Network\Networkable;
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 class SocketRawDataHandler extends BaseRawDataHandler implements Networkable {
-       /**
-        * Last socket error (default: Success)
-        */
-       private $lastSocketError = 0;
-
        /**
         * Protected constructor
         *
index 29a0a45456affb156078d668cdf88da21d4c5caf..460835bb6871b169fe8e591fb79b815f0b2aa63c 100644 (file)
@@ -30,11 +30,6 @@ use Hub\Pool\BasePool;
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 class TcpRawDataHandler extends BaseRawDataHandler implements Networkable {
-       /**
-        * Last socket error (default: Success)
-        */
-       private $lastSocketError = 0;
-
        /**
         * Protected constructor
         *
@@ -126,7 +121,5 @@ class TcpRawDataHandler extends BaseRawDataHandler implements Networkable {
                        $this->addRawDataToStacker($rawData);
                }
        }
-}
 
-// [EOF]
-?>
+}
index 9a45b80ff0f4120967842a5cc783ce412a94dcd5..ef0cc605b32920a6be2446f0e7774ce949501089 100644 (file)
@@ -29,11 +29,6 @@ use Hub\Network\Networkable;
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 class ???RawDataHandler extends BaseRawDataHandler implements Networkable {
-       /**
-        * Last socket error (default: Success)
-        */
-       private $lastSocketError = 0;
-
        /**
         * Protected constructor
         *
index 625f0806e9cccd3844121e95a9895aa5da8806fd..6686c61282b3d21957878102857a4eca35bc4153 100644 (file)
@@ -218,7 +218,7 @@ class BaseListener extends BaseHubSystem implements Visitable {
                $infoInstance->fillWithListenerInformation($this);
 
                // Register the socket
-               $registryInstance->registerSocket($infoInstance, $socketInstance);
+               $registryInstance->registerSocketInstance($infoInstance, $socketInstance);
 
                // And set it here
                $this->setSocketInstance($socketInstance);
@@ -373,7 +373,7 @@ class BaseListener extends BaseHubSystem implements Visitable {
                        $peerPort    = '0';
 
                        // Get peer name
-                       if (!socket_getpeername($newSocket, $peerAddress)) {
+                       if (!socket_getpeername($newSocket, $peerAddress, $peerPort)) {
                                // Handle this socket error with a faked recipientData array
                                $this->handleSocketError(__METHOD__, __LINE__, $newSocket, array('0.0.0.0', '0'));
                        } // END - if
@@ -398,7 +398,7 @@ class BaseListener extends BaseHubSystem implements Visitable {
                        $registryInstance = SocketRegistryFactory::createSocketRegistryInstance();
 
                        // Register the socket with the registry and with the faked array
-                       $registryInstance->registerSocket($infoInstance, $newSocket, $packageData);
+                       $registryInstance->registerSocketInstance($infoInstance, $newSocket, $packageData);
                } // END - if
 
                // Do we have to rewind?
index b53d669a527a1eb98bbbb0c51e630e6f6fa32d44..e939c9f82d24494f01d6fe684604705c003e470f 100644 (file)
@@ -70,7 +70,7 @@ class SocketFileListener extends BaseListener implements Listenable {
                // Create socket with factory
                $socketInstance = SocketFactory::createListenFileSocket($this);
 
-               // Set the main socket
+               // Set the socket instance
                $this->registerServerSocketInstance($socketInstance);
 
                // Initialize the peer pool instance
index 1e35c4ada4906e99a9aa923aa3dc8bd0d4724802..3c26b71d19456d4510757de04136fbdcec2c3daf 100644 (file)
@@ -639,7 +639,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R
                        //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Registering socket ' . $socketInstance . ' ...');
 
                        // Then register it
-                       $registryInstance->registerSocket($infoInstance, $socketInstance, $packageData);
+                       $registryInstance->registerSocketInstance($infoInstance, $socketInstance, $packageData);
                } elseif (!$helperInstance->getStateInstance()->isPeerStateConnected()) {
                        // Is not connected, then we cannot send
                        self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE: Unexpected peer state ' . $helperInstance->getStateInstance()->__toString() . ' detected.');
index 82ab76481f787873a97351f512cca817528d6554..0b61576b18fff98a4bc6e6cc350cd50ef03599a0 100644 (file)
@@ -214,7 +214,7 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke
         * @throws      SocketAlreadyRegisteredException        If the given socket is already registered
         * @return      void
         */
-       public function registerSocket (ShareableInfo $infoInstance, StorableSocket $socketInstance, array $packageData = array()) {
+       public function registerSocketInstance (ShareableInfo $infoInstance, StorableSocket $socketInstance, array $packageData = array()) {
                // Debug message
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('SOCKET-REGISTRY:info=' . $infoInstance->getProtocolName() . ',socketResource[' . gettype($socketInstance->getSocketResource()) . ']=' . $socketInstance->getSocketResource() . ' - CALLED!');
 
index 0793c6ea8e216d7ed84d2e5f8e3e2eb1c1f8fc83..a826fa2a420950df7da2e10bbe6816a3c60f7dde 100644 (file)
@@ -44,7 +44,7 @@ class SocketShutdownException extends AbstractSocketException {
                $message = sprintf('[%s:] Socket %s cannot be shutdown down. errNo=%s, errStr=%s',
                        $helperInstance->__toString(),
                        $socketInstance->getSocketResource(),
-                       $socketInstance->getLastSocketError(),
+                       $socketInstance->getLastSocketErrorCode(),
                        $socketInstance->getLastSocketErrorMessage()
                );
 
index 45945c85a754dabe766b174900c7f6093a1d0f5d..e48a80439b733fe0fc18bc4d36fa13da61129102 100644 (file)
@@ -82,13 +82,6 @@ interface StorableSocket extends FrameworkInterface {
         */
        function getSocketPeerName (&$peerAddress, &$peerPort);
 
-       /**
-        * Some "getter" for socket type of stored socket
-        *
-        * @return      $socketType             Socket type
-        */
-       function getSocketType ();
-
        /**
         * Getter for socket procotol field
         *
@@ -145,15 +138,15 @@ interface StorableSocket extends FrameworkInterface {
        /**
         * Getter for last socket error
         *
-        * @return      $lastSocketError        Last socket error
+        * @return      $errorCode      Last socket error
         * @throws      InvalidSocketException  If stored socket is invalid
         */
-       function getLastSocketError ();
+       function getLastSocketErrorCode ();
 
        /**
         * Getter for last socket error message
         *
-        * @return      $lastSocketErrorMessage Last socket error message
+        * @return      $errorMessage   Last socket error message
         * @throws      InvalidSocketException  If stored socket is invalid
         */
        function getLastSocketErrorMessage ();
index 43be4ece7a1550714d5612a80fe59ffaa4de2160..d02c0dd99ea6769a5c3deb202e8be51c70771142 100644 (file)
@@ -3,6 +3,7 @@
 namespace Hub\Registry\Socket;
 
 // Import application-specific stuff
+use Hub\Container\Socket\StorableSocket;
 use Hub\Information\ShareableInfo;
 
 // Import framework stuff
@@ -37,20 +38,20 @@ interface RegisterableSocket extends Registerable {
         * false only the instance will be checked.
         *
         * @param       $infoInstance           An instance of a ShareableInfo class
-        * @param       $socketResource         A valid socket resource
+        * @param       $socketInstance         An instance of a StorableSocket class
         * @return      $isRegistered           Whether the given socket resource is registered
         */
-       function isSocketRegistered (ShareableInfo $infoInstance, $socketResource);
+       function isSocketRegistered (ShareableInfo $infoInstance, StorableSocket $socketInstance);
 
        /**
         * Registeres given socket for listener or throws an exception if it is already registered
         *
         * @param       $infoInstance   An instance of a ShareableInfo class
-        * @param       $socketResource         A valid socket resource
+        * @param       $socketInstance         An instance of a StorableSocket class
         * @return      void
         * @throws      SocketAlreadyRegisteredException        If the given socket is already registered
         */
-       function registerSocket (ShareableInfo $infoInstance, $socketResource);
+       function registerSocketInstance (ShareableInfo $infoInstance, StorableSocket $socketInstance);
 
        /**
         * Getter for given listener's socket resource