public abstract class TcpServer extends Thread implements IClientStoppedListener
Thread.State, Thread.UncaughtExceptionHandler| Modifier and Type | Field and Description |
|---|---|
protected TcpClientConf |
clientConf
The Client conf.
|
protected Set<TcpClient> |
clients
The Clients.
|
protected TcpServerConf |
serverConf
The Server conf.
|
protected AtomicReference<ServerSocket> |
serverSocket
The Server socket.
|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY| Constructor and Description |
|---|
TcpServer()
Instantiates a new Tcp server.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cancel()
Cancel.
|
void |
clientStopped(TcpClient client)
Clients notify them self when they are done
|
TcpClientConf |
getClientConf()
Gets client conf.
|
Set<TcpClient> |
getClients()
Gets clients.
|
TcpServerConf |
getServerConf()
Gets server conf.
|
protected abstract TcpClient |
newClient(Socket socket)
Inheriting classes must be able to provide a new client
|
void |
run() |
void |
setClientConf(TcpClientConf clientConf)
Sets client conf.
|
void |
setServerConf(TcpServerConf serverConf)
Sets server conf.
|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yieldprotected final AtomicReference<ServerSocket> serverSocket
protected TcpServerConf serverConf
protected TcpClientConf clientConf
protected abstract TcpClient newClient(Socket socket)
socket - the socketpublic void clientStopped(TcpClient client)
clientStopped in interface IClientStoppedListenerclient - tcpclientpublic void cancel()
public TcpClientConf getClientConf()
public void setClientConf(TcpClientConf clientConf)
clientConf - the client confpublic TcpServerConf getServerConf()
public void setServerConf(TcpServerConf serverConf)
serverConf - the server confCopyright © 2011–2019 Danish Maritime Authority. All rights reserved.