public class TCPConnector
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
int |
fBytesIn |
int |
fBytesOut |
java.net.Socket |
fConnection |
java.io.InputStream |
fInput |
protected boolean |
fIsConnected |
IncomingTCPClientPacket |
fLastIncomingPacket |
MessageCollectorTCPClientPacket |
fLastMessageCollectorPacket |
TCPClientMessageCollector |
fMessageCollector |
ExtasysTCPClient |
fMyTCPClient |
java.io.OutputStream |
fOutput |
Constructor and Description |
---|
TCPConnector(ExtasysTCPClient myTCPClient,
java.lang.String name,
java.net.InetAddress serverIP,
int serverPort,
int readBufferSize)
Constructs a new TCP Connector.
|
TCPConnector(ExtasysTCPClient myTCPClient,
java.lang.String name,
java.net.InetAddress serverIP,
int serverPort,
int readBufferSize,
char ETX)
Constructs a new TCP Connector with message collector use (ETX).
|
TCPConnector(ExtasysTCPClient myTCPClient,
java.lang.String name,
java.net.InetAddress serverIP,
int serverPort,
int readBufferSize,
java.lang.String splitter)
Constructs a new TCP Connector with message collector use (Splitter).
|
Modifier and Type | Method and Description |
---|---|
int |
getBytesIn()
Return the number of bytes received from this connector.
|
int |
getBytesOut()
Returns the number of bytes send from this connector.
|
java.lang.String |
getMessageSplitter()
Returns message collector's splitter in string format.
|
ExtasysTCPClient |
getMyExtasysTCPClient()
Returns the main Extasys TCP Client of the connector.
|
TCPClientMessageCollector |
getMyMessageCollector()
Returns the message collector of this connector.
|
java.lang.String |
getName()
Returns the name of this connector.
|
int |
getReadBufferSize()
Returns the read buffer size of the connection.
|
java.net.InetAddress |
getServerIPAddress()
Returns the remote server's ip address.
|
int |
getServerPort()
Returns the remote server TCP port.
|
boolean |
isActive()
Returns the active state of this connector.
|
boolean |
isConnected()
Returns True if this conenctor is connected to the host.
|
boolean |
isMessageCollectorInUse()
Returns the active state of the message collector.
|
void |
SendData(byte[] bytes,
int offset,
int length)
Send data to server.
|
void |
SendData(java.lang.String data)
Send string data to server.
|
void |
Start()
Start the connector (connect to the server).
|
void |
Stop()
Stop the connector (disconnect from the server).
|
public ExtasysTCPClient fMyTCPClient
protected boolean fIsConnected
public java.net.Socket fConnection
public java.io.InputStream fInput
public java.io.OutputStream fOutput
public int fBytesIn
public int fBytesOut
public TCPClientMessageCollector fMessageCollector
public IncomingTCPClientPacket fLastIncomingPacket
public MessageCollectorTCPClientPacket fLastMessageCollectorPacket
public TCPConnector(ExtasysTCPClient myTCPClient, java.lang.String name, java.net.InetAddress serverIP, int serverPort, int readBufferSize)
myTCPClient
- is the TCP connector's main Extasys TCP Client.name
- is the connector's name.serverIP
- is the server's ip address the connector will use to connect.serverPort
- is the server's tcp port the connector will use to connect.readBufferSize
- is the read buffer size in bytes for this connection.public TCPConnector(ExtasysTCPClient myTCPClient, java.lang.String name, java.net.InetAddress serverIP, int serverPort, int readBufferSize, char ETX)
myTCPClient
- is the TCP connector's main Extasys TCP Client.name
- is the connector's name.serverIP
- is the server's ip address the connector will connect to.serverPort
- is the server's tcp port the connector will connect to.readBufferSize
- is the read buffer size in bytes for this connection.ETX
- is the End of Text character.public TCPConnector(ExtasysTCPClient myTCPClient, java.lang.String name, java.net.InetAddress serverIP, int serverPort, int readBufferSize, java.lang.String splitter)
myTCPClient
- is the TCP connector's main Extasys TCP Client.name
- is the connector's name.serverIP
- is the server's ip address the connector will connect to.serverPort
- is the server's tcp port the connector will connect to.readBufferSize
- is the read buffer size in bytes for this connection.splitter
- is the message splitter.public void Start() throws java.lang.Exception
java.lang.Exception
public void Stop()
public void SendData(java.lang.String data) throws ConnectorDisconnectedException, ConnectorCannotSendPacketException
data
- is the string to send.ConnectorDisconnectedException
ConnectorCannotSendPacketException
public void SendData(byte[] bytes, int offset, int length) throws ConnectorDisconnectedException, ConnectorCannotSendPacketException
bytes
- is the byte array to be send.offset
- is the position in the data buffer at witch to begin sending.length
- is the number of the bytes to be send.ConnectorDisconnectedException
ConnectorCannotSendPacketException
public ExtasysTCPClient getMyExtasysTCPClient()
public boolean isActive()
public java.lang.String getName()
public java.net.InetAddress getServerIPAddress()
public int getServerPort()
public int getReadBufferSize()
public int getBytesIn()
public int getBytesOut()
public boolean isMessageCollectorInUse()
public TCPClientMessageCollector getMyMessageCollector()
public java.lang.String getMessageSplitter()
public boolean isConnected()