Class AbstractSocketServer
- java.lang.Object
-
- com.metratec.lib.connection.server.AbstractSocketServer
-
- Direct Known Subclasses:
SocketServer
,SslSocketServer
public abstract class AbstractSocketServer extends java.lang.Object
- Author:
- man
-
-
Constructor Summary
Constructors Constructor Description AbstractSocketServer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getPort()
boolean
isRunning()
void
start(int serverPort, int backlog, java.net.InetAddress bindAddr, ClientConnectionListener listener)
Start the waiting for new client to connectvoid
start(int serverPort, ClientConnectionListener listener)
Start the waiting for new client to connectvoid
stop()
stop the server
-
-
-
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, or0
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 socketlistener
- theClientConnectionListener
- Throws:
CommConnectionException
- throwed if the server can not be created
-
start
public void start(int serverPort, ClientConnectionListener listener) throws CommConnectionException
Start the waiting for new client to connect- Parameters:
serverPort
- server portlistener
- theClientConnectionListener
- 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
-
-