public class TcpConnection
extends java.lang.Thread
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_SOCKET_TIMEOUT
Default value for the maximum time that the tcp connection can remain active after been halted (in milliseconds)
|
Constructor and Description |
---|
TcpConnection(TcpSocket socket,
long alive_time,
TcpConnectionListener listener)
Costructs a new TcpConnection.
|
TcpConnection(TcpSocket socket,
TcpConnectionListener listener)
Costructs a new TcpConnection.
|
Modifier and Type | Method and Description |
---|---|
IpAddress |
getLocalAddress()
Gets the local address.
|
int |
getLocalPort()
Gets the local port.
|
IpAddress |
getRemoteAddress()
Gets the remote IP address.
|
int |
getRemotePort()
Gets the remote port.
|
TcpSocket |
getSocket()
Gets the TcpSocket.
|
void |
halt()
Stops running.
|
boolean |
isRunning()
Whether the service is running.
|
void |
run()
Runs the tcp receiver.
|
void |
send(byte[] buff)
Sends data.
|
void |
send(byte[] buff,
int offset,
int len)
Sends data.
|
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 TcpConnection(TcpSocket socket, TcpConnectionListener listener)
public TcpConnection(TcpSocket socket, long alive_time, TcpConnectionListener listener)
public boolean isRunning()
public TcpSocket getSocket()
public IpAddress getRemoteAddress()
public int getRemotePort()
public IpAddress getLocalAddress()
public int getLocalPort()
public void halt()
public void send(byte[] buff, int offset, int len) throws java.io.IOException
java.io.IOException
public void send(byte[] buff) throws java.io.IOException
java.io.IOException
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