Class AbstractSocketServer

  • Direct Known Subclasses:
    SocketServer, SslSocketServer

    public abstract class AbstractSocketServer
    extends java.lang.Object
    Author:
    man
    • Constructor Detail

      • AbstractSocketServer

        public AbstractSocketServer()
    • Method Detail

      • isRunning

        public boolean isRunning()
        Returns:
        true if the server is waiting for new client
      • start

        public void start​(int serverPort,
                          int backlog,
                          java.net.InetAddress bindAddr,
                          ClientConnectionListener listener)
                   throws CommConnectionException
        Start the waiting for new client to connect
        Parameters:
        serverPort - the port number, or 0 to use a port number that is automatically allocated.
        backlog - requested maximum length of the queue of incoming connections.
        bindAddr - the local InetAddress the server will bind to socket
        listener - the ClientConnectionListener
        Throws:
        CommConnectionException - throwed if the server can not be created
      • stop

        public void stop()
        stop the server
      • getPort

        public int getPort()
        Returns:
        the current using server port or -1 if the server not started