public abstract class TCPServer
extends java.lang.Object
Abstract TCP/IP server.
Constructor and Description |
---|
TCPServer(java.net.ServerSocket connection)
Constructs a new instance of
TCPServer with Socket as the underlying connection. |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
addConnection(java.net.Socket client)
Adds a connection.
|
protected java.net.ServerSocket |
getCurrentConnection()
Returns the current
Socket . |
protected java.lang.String |
getName()
Returns the name of this TCPServer.
|
boolean |
isStopped()
Returns
true if the TCPServer is stopped. |
void |
start()
Starts the
TCPServer . |
void |
stop()
Stops the
TCPServer and closes the connection. |
public TCPServer(java.net.ServerSocket connection)
Constructs a new instance of TCPServer
with Socket
as the underlying connection.
connection
- the Socket
protected abstract void addConnection(java.net.Socket client)
client
- the Socket
to addprotected java.net.ServerSocket getCurrentConnection()
Socket
.Socket
protected java.lang.String getName()
public boolean isStopped()
Returns true
if the TCPServer
is stopped.
true
if the TCPServer
is stopped, false
otherwisepublic void start()
public void stop()
Stops the TCPServer
and closes the connection.