public class TcpServer
extends java.lang.Thread
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_SOCKET_BACKLOG
Default ServerSocket backlog value
|
static int |
DEFAULT_SOCKET_TIMEOUT
Default value for the maximum time that the tcp server can remain active after been halted (in milliseconds)
|
Constructor and Description |
---|
TcpServer(int port,
IpAddress bind_ipaddr,
long alive_time,
TcpServerListener listener)
Costructs a new TcpServer
|
TcpServer(int port,
IpAddress bind_ipaddr,
TcpServerListener listener)
Costructs a new TcpServer
|
TcpServer(int port,
TcpServerListener listener)
Costructs a new TcpServer
|
TcpServer(java.net.ServerSocket server_socket,
TcpServerListener listener)
Costructs a new TcpServer
|
Modifier and Type | Method and Description |
---|---|
int |
getPort()
Gets server port
|
void |
halt()
Stops running
|
boolean |
isRunning()
Whether the service is running
|
void |
run()
Runs the server
|
java.lang.String |
toString()
Gets a String representation of the Object
|
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, yield
public static final int DEFAULT_SOCKET_TIMEOUT
public static int DEFAULT_SOCKET_BACKLOG
public TcpServer(java.net.ServerSocket server_socket, TcpServerListener listener) throws java.io.IOException
java.io.IOException
public TcpServer(int port, TcpServerListener listener) throws java.io.IOException
java.io.IOException
public TcpServer(int port, IpAddress bind_ipaddr, TcpServerListener listener) throws java.io.IOException
java.io.IOException
public TcpServer(int port, IpAddress bind_ipaddr, long alive_time, TcpServerListener listener) throws java.io.IOException
java.io.IOException
public int getPort()
public boolean isRunning()
public void halt()
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public java.lang.String toString()
toString
in class java.lang.Thread