public class ExtasysTCPClient
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
java.util.concurrent.ThreadPoolExecutor |
fMyThreadPool |
| Constructor and Description |
|---|
ExtasysTCPClient(java.lang.String name,
java.lang.String description,
int corePoolSize,
int maximumPoolSize)
Constructs a new Extasys TCP Client.
|
| Modifier and Type | Method and Description |
|---|---|
TCPConnector |
AddConnector(java.lang.String name,
java.net.InetAddress serverIP,
int serverPort,
int readBufferSize)
Add a new connector to this client.
|
TCPConnector |
AddConnector(java.lang.String name,
java.net.InetAddress serverIP,
int serverPort,
int readBufferSize,
char ETX)
Add a new connector with message collector.
|
TCPConnector |
AddConnector(java.lang.String name,
java.net.InetAddress serverIP,
int serverPort,
int readBufferSize,
java.lang.String splitter)
Add a new connector with message collector.
|
void |
Dispose()
Dispose the client.
|
int |
getBytesIn()
Returns the total number of bytes received from all the connectors of the client.
|
int |
getBytesOut()
Returns the total number of bytes send from all the connectors of the client.
|
java.util.ArrayList |
getConnectors()
Return ArrayList with the client's connectors.
|
java.lang.String |
getDescription()
Return the description of the client.
|
java.util.concurrent.ThreadPoolExecutor |
getMyThreadPool()
Return the client's Thread Pool.
|
java.lang.String |
getName()
Return the name of the client.
|
void |
OnConnect(TCPConnector connector)
A connector of this client connected to a server.
|
void |
OnDataReceive(TCPConnector connector,
DataFrame data)
A connector of this client receives data.
|
void |
OnDisconnect(TCPConnector connector)
A connector of this client has been disconnected.
|
void |
RemoveConnector(java.lang.String name)
Stop and remove a connector from this client.
|
void |
SendData(byte[] bytes,
int offset,
int length)
Send data from all connector's to all hosts.
|
void |
SendData(java.lang.String data)
Send data from all connector's to all hosts.
|
void |
Start()
Start or restart the client.
|
void |
Stop()
Stop the client.
|
public ExtasysTCPClient(java.lang.String name,
java.lang.String description,
int corePoolSize,
int maximumPoolSize)
name - is the name of the client.description - is the description of the client.corePoolSize - is the number of threads to keep in the pool, even if they are idle.maximumPoolSize - is the maximum number of threads to allow in the pool.public TCPConnector AddConnector(java.lang.String name, java.net.InetAddress serverIP, int serverPort, int readBufferSize)
name - is the connector's name.serverIP - is the remote host's (server) IP address.serverPort - is the remote host's (server) port.readBufferSize - is the read buffer size for this connection in bytes.public TCPConnector AddConnector(java.lang.String name, java.net.InetAddress serverIP, int serverPort, int readBufferSize, char ETX)
name - is the connector's name.serverIP - is the remote host's (server) IP address.serverPort - is the remote host's (server) port.readBufferSize - is the read buffer size for this connection in bytes.ETX - is the End of Text character.public TCPConnector AddConnector(java.lang.String name, java.net.InetAddress serverIP, int serverPort, int readBufferSize, java.lang.String splitter)
name - is the connector's name.serverIP - is the remote host's (server) IP address.serverPort - is the remote host's (server) port.readBufferSize - is the read buffer size for this connection in bytes.splitter - is the message splitter.public void RemoveConnector(java.lang.String name)
name - is the connector's name.public void Start()
throws java.lang.Exception
java.lang.Exceptionpublic void Stop()
public void Dispose()
public void SendData(java.lang.String data)
throws ConnectorDisconnectedException,
ConnectorCannotSendPacketException
data - is the string to be send.ConnectorDisconnectedExceptionConnectorCannotSendPacketExceptionpublic 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.ConnectorDisconnectedExceptionConnectorCannotSendPacketExceptionpublic void OnDataReceive(TCPConnector connector, DataFrame data)
connector - is the client's connector.data - is the received data.public void OnConnect(TCPConnector connector)
connector - public void OnDisconnect(TCPConnector connector)
connector - public java.lang.String getName()
public java.lang.String getDescription()
public java.util.ArrayList getConnectors()
public java.util.concurrent.ThreadPoolExecutor getMyThreadPool()
public int getBytesIn()
public int getBytesOut()