|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectnetP5.AbstractTcpClient
public abstract class AbstractTcpClient
| Field Summary | |
|---|---|
static int |
MODE_NEWLINE
terminator is newline. |
static int |
MODE_READLINE
terminator is readline. |
static int |
MODE_STREAM
no terminator required, packets are sent via a tcp stream. |
static int |
MODE_TERMINATED
terminator is terminated, by default this is character '\0' and can be set with setTerminator |
| Constructor Summary | |
|---|---|
AbstractTcpClient(AbstractTcpServer theTcpServer,
Socket theSocket,
TcpPacketListener theTcpPacketListener,
int theServerPort,
int theMode)
|
|
AbstractTcpClient(String theHost,
int thePort)
|
|
AbstractTcpClient(String theHost,
int thePort,
int theMode)
|
|
AbstractTcpClient(TcpPacketListener theTcpPacketListener,
String theHost,
int thePort)
|
|
AbstractTcpClient(TcpPacketListener theTcpPacketListener,
String theHost,
int thePort,
int theMode)
|
|
| Method Summary | |
|---|---|
void |
dispose()
stop and dispose a tcp client. |
boolean |
equals(NetAddress theNetAddress)
|
boolean |
equals(TcpClient theClient)
|
String |
getString()
|
StringBuffer |
getStringBuffer()
|
abstract void |
handleInput()
|
abstract void |
handleStatus(int theIndex)
|
TcpPacketListener |
listener()
|
int |
mode()
get the mode of the terminator. |
NetAddress |
netaddress()
Deprecated. |
NetAddress |
netAddress()
|
void |
reconnect()
when a TCP connection is lost, reconnect to the server with reconnect(). |
void |
run()
|
void |
send(byte[] theBytes)
|
void |
send(byte[][] theBytes)
|
void |
send(String theString)
|
int |
serverport()
get the server port. |
void |
setTerminator(char theTerminator)
to parse an incomming tcp message, a terminator character is required to determine the end of the message so that it can be parsed and forwarded. |
Socket |
socket()
get the instance of the socket. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int MODE_READLINE
public static final int MODE_TERMINATED
public static final int MODE_NEWLINE
public static final int MODE_STREAM
| Constructor Detail |
|---|
public AbstractTcpClient(TcpPacketListener theTcpPacketListener,
String theHost,
int thePort)
theTcpPacketListener - TcpPacketListenertheHost - StringthePort - int
public AbstractTcpClient(String theHost,
int thePort)
theHost - StringthePort - int
public AbstractTcpClient(TcpPacketListener theTcpPacketListener,
String theHost,
int thePort,
int theMode)
theTcpPacketListener - TcpPacketListenertheHost - StringthePort - inttheMode - int
public AbstractTcpClient(String theHost,
int thePort,
int theMode)
theHost - StringthePort - inttheMode - int
public AbstractTcpClient(AbstractTcpServer theTcpServer,
Socket theSocket,
TcpPacketListener theTcpPacketListener,
int theServerPort,
int theMode)
theTcpServer - AbstractTcpServertheSocket - SockettheTcpPacketListener - TcpPacketListenertheServerPort - inttheMode - int| Method Detail |
|---|
public void reconnect()
public void setTerminator(char theTerminator)
theTerminator - public void dispose()
public void run()
run in interface Runnablepublic abstract void handleInput()
public abstract void handleStatus(int theIndex)
theIndex - public TcpPacketListener listener()
public int serverport()
public Socket socket()
public int mode()
public String getString()
public StringBuffer getStringBuffer()
public void send(byte[] theBytes)
public void send(byte[][] theBytes)
public void send(String theString)
public NetAddress netAddress()
public NetAddress netaddress()
public boolean equals(NetAddress theNetAddress)
theNetAddress - NetAddress
public boolean equals(TcpClient theClient)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||