Class TCPServerConnector

    • Constructor Detail

      • TCPServerConnector

        public TCPServerConnector()
        Default constructor.
    • Method Detail

      • getServerConnector

        public TCPServerConnector getServerConnector()
        Retrieves server connector.
        Returns:
        The server Connector if this Connector is handling a TCP client session.
      • setServerConnector

        public void setServerConnector​(TCPServerConnector aServerConnector)
        Sets the server Connector for this Connector.
        Parameters:
        aServerConnector - The serverConnector.
      • isAccepting

        public boolean isAccepting()
        Checks whether this Connector is currently waiting for a client connection.
        Returns:
        true if this Connector is currently waiting for a client connection.
      • isTerminating

        public boolean isTerminating()
        Checks if a termination is requested.
        Returns:
        true if this Connector has the termination flag set.
      • initialize

        public void initialize​(java.lang.Object aObj)
                        throws java.lang.Exception
        Initialize the Connector. To initialize this Connector with a TCP client session provide a java.net.Socket object for the obj parameter. In all other cases, the Connector will initialize a TCP server session.
        Specified by:
        initialize in interface ConnectorInterface
        Overrides:
        initialize in class Connector
        Parameters:
        aObj - Null, Socket or ConnectorMode class
        Throws:
        java.lang.Exception - if the initialization of this connector fails.
      • getNextClient

        public ConnectorInterface getNextClient()
                                         throws java.lang.Exception
        Server mode - returns a new instance of the Connector for each client connection.
        Specified by:
        getNextClient in interface ConnectorInterface
        Overrides:
        getNextClient in class Connector
        Returns:
        the clone of itself
        Throws:
        java.lang.Exception - if an error occurs.
      • putEntry

        public void putEntry​(Entry aEntry)
                      throws java.lang.Exception
        Flushes the output stream to the client.
        Specified by:
        putEntry in interface ConnectorInterface
        Overrides:
        putEntry in class Connector
        Parameters:
        aEntry - This parameter is ignored
        Throws:
        java.lang.Exception - if an error occurs.
      • replyEntry

        public void replyEntry​(Entry aEntry)
                        throws java.lang.Exception
        Flushes the output stream to the client and closes the connection.
        Specified by:
        replyEntry in interface ConnectorInterface
        Overrides:
        replyEntry in class Connector
        Parameters:
        aEntry - This parameter is ignored
        Throws:
        java.lang.Exception - if an error occurs.
      • terminateServer

        public void terminateServer()
                             throws java.lang.Exception
        This method tries to terminate the server by setting the termination flag for the Connector returned by getServerConnector and immediately connecting to its port.
        Specified by:
        terminateServer in interface ConnectorInterface
        Overrides:
        terminateServer in class Connector
        Throws:
        java.lang.Exception - if an error occurs
      • terminate

        public void terminate()
                       throws java.lang.Exception
        Terminate the connector.
        Specified by:
        terminate in interface ConnectorInterface
        Overrides:
        terminate in class Connector
        Throws:
        java.lang.Exception - if an error occurs.
      • getVersion

        public java.lang.String getVersion()
        Version information.
        Specified by:
        getVersion in interface VersionInfoInterface
        Returns:
        version information