// CFG: SOCKET-REGISTRY-CLASS
$cfg->setConfigEntry('socket_registry_class', 'SocketRegistry');
+// CFG: SOCKET-CONTAINER-CLASS
+$cfg->setConfigEntry('socket_container_class', 'SocketContainer');
+
// [EOF]
?>
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
interface ProtocolHandler extends FrameworkInterface {
+ /**
+ * Getter for port number to satify ProtocolHandler
+ *
+ * @return $port The port number
+ */
+ function getPort ();
+
+ /**
+ * Getter for protocol
+ *
+ * @return $protocol Used protocol
+ */
+ function getProtocol ();
+
+ /**
+ * Getter for "this" socket resource
+ *
+ * @return $socketResource A valid socket resource
+ */
+ function getSocketResource ();
}
// [EOF]
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class ???Listener extends BaseListener implements Listenable, Visitable {
+class ???Listener extends BaseListener implements Listenable {
/**
* Protected constructor
*
// Check it
$isServerSocket = ((is_resource($socketResource)) && (!@socket_getpeername($socketResource, $peerName)));
- // We need to clear the error here
- socket_clear_error($socketResource);
+ // We need to clear the error here if it is a resource
+ if ($isServerSocket === true) {
+ // Clear the error
+ socket_clear_error($socketResource);
+ } // END - if
// Check peer name, it must be empty
$isServerSocket = (($isServerSocket) && (empty($peerName)));
return $this->listenPort;
}
+ /**
+ * Getter for port number to satify ProtocolHandler
+ *
+ * @return $port The port number
+ */
+ public final function getPort () {
+ return $this->getListenPort();
+ }
+
/**
* "Setter" to set listen address from configuration entry
*
$registryInstance = SocketRegistryFactory::createSocketRegistryInstance();
// Get the socket resource
- $socketResource = $registryInstance->getSocketResource($this);
+ $socketResource = $registryInstance->getRegisteredSocketResource($this);
// Return it
return $socketResource;
return $this->getListenerInstance()->getListenPort();
}
+ /**
+ * Getter for port
+ *
+ * @return $port The port
+ */
+ public final function getPort () {
+ return $this->getListenerInstance()->getPort();
+ }
+
/**
* Getter for protocol
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class Udp???Listener extends BaseListener implements Listenable, Visitable {
+class Udp???Listener extends BaseListener implements Listenable {
/**
* Protected constructor
*