public class TCPListener
extends java.lang.Object
Constructor and Description |
---|
TCPListener(java.lang.String name,
java.net.InetAddress ipAddress,
int port,
int maxConnections,
int readBufferSize,
int connectionTimeOut,
int backLog)
Constructs a new TCP listener.
|
TCPListener(java.lang.String name,
java.net.InetAddress ipAddress,
int port,
int maxConnections,
int readBufferSize,
int connectionTimeOut,
int backLog,
char splitter)
Constructs a new TCP listener.
|
TCPListener(java.lang.String name,
java.net.InetAddress ipAddress,
int port,
int maxConnections,
int readBufferSize,
int connectionTimeOut,
int backLog,
java.lang.String splitter)
Constructs a new TCP listener.
|
Modifier and Type | Method and Description |
---|---|
void |
AddClient(TCPClientConnection client)
Add client to connected clients list.
|
int |
getBytesIn()
Returns the number of bytes received from this TCPListener.
|
int |
getBytesOut()
Returns the number of bytes sent from this TCPListener.
|
java.util.Hashtable |
getConnectedClients()
Returns a Hashtable with the connected clients of this listener.
|
int |
getConnectionTimeOut()
Returns the connections time-out in milliseconds of this listener.
|
java.net.InetAddress |
getIPAddress()
Returns listener's IP address.
|
int |
getMaxConnections()
Returns allowed maximum connections.
|
java.lang.String |
getMessageSplitter()
Returns message collector's splitter in string format.
|
ExtasysTCPServer |
getMyExtasysTCPServer()
Returns a reference of this listener's main Extasys TCP server.
|
java.lang.String |
getName()
Return's this listener's name.
|
int |
getPort()
Returns listener's port.
|
int |
getReadBufferSize()
Returns read buffer size in bytes for each client connection
of this TCPListener.
|
java.net.ServerSocket |
getServerSocket()
Returns TCP listener's ServerSocket.
|
boolean |
isActive()
Returns the active state of this TCPListener.
|
boolean |
isMessageCollectorInUse()
Returns the active state of this listener's message collector.
|
void |
RemoveClient(java.lang.String ipAddress)
Remove client from connected clients list.
|
void |
ReplyToAll(byte[] bytes,
int offset,
int length)
Send data to all connected clients.
|
void |
ReplyToAll(java.lang.String data)
Send data to all connected clients.
|
void |
ReplyToAllExceptSender(byte[] bytes,
int offset,
int length,
TCPClientConnection sender)
Send data to all connected clients excepts sender.
|
void |
ReplyToAllExceptSender(java.lang.String data,
TCPClientConnection sender)
Send data to all connected clients excepts sender.
|
void |
setConnectionTimeOut(int value)
Set the connections time-out in milliseconds of this listener.
|
void |
setMaxConnections(int value)
Set the maximum allowed connections of this listener.
|
void |
setMyExtasysTCPServer(ExtasysTCPServer server)
Set my Extasys TCP server.
|
void |
setReadBufferSize(int value)
Set read buffer size in bytes for each client connection
of this TCPListener.
|
void |
Start()
Start or restart the TCPListener.
|
void |
Stop()
Stop the TCP listener.
|
public TCPListener(java.lang.String name, java.net.InetAddress ipAddress, int port, int maxConnections, int readBufferSize, int connectionTimeOut, int backLog)
name
- is the listener's name.ipAddress
- is the listener's IP Address.port
- is the listener's port.maxConnections
- is the listener's maximum connections limit.readBufferSize
- is the listener's each connection read buffer size in bytes.connectionTimeOut
- is the listener's connections time-out time in milliseconds.backLog
- is the number of outstanding connection requests this listener can have.public TCPListener(java.lang.String name, java.net.InetAddress ipAddress, int port, int maxConnections, int readBufferSize, int connectionTimeOut, int backLog, char splitter)
name
- is the listener's name.ipAddress
- is the listener's IP Address.port
- is the listener's port.maxConnections
- is the listener's maximum allowed connections..readBufferSize
- is the listener's each connection read buffer size in bytes.connectionTimeOut
- is the listener's connections time-out in milliseconds. Set to 0 for no time-outbackLog
- is the number of outstanding connection requests this listener can have.splitter
- is the message splitter.public TCPListener(java.lang.String name, java.net.InetAddress ipAddress, int port, int maxConnections, int readBufferSize, int connectionTimeOut, int backLog, java.lang.String splitter)
name
- is the listener's name.ipAddress
- is the listener's IP Address.port
- is the listener's port.maxConnections
- is the listener's maximum allowed connections..readBufferSize
- is the listener's each connection read buffer size in bytes.connectionTimeOut
- is the listener's connections time-out in milliseconds. Set to 0 for no time-outbackLog
- is the number of outstanding connection requests this listener can have.splitter
- is the message splitter.public void Start() throws java.io.IOException, java.lang.Exception
java.io.IOException
java.lang.Exception
public void Stop()
public void AddClient(TCPClientConnection client)
client
- is the client object to add.public void RemoveClient(java.lang.String ipAddress)
ipAddress
- is the client's IP address.public void ReplyToAll(java.lang.String data)
data
- is the string to be send.public void ReplyToAll(byte[] bytes, int offset, int length)
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.public void ReplyToAllExceptSender(java.lang.String data, TCPClientConnection sender)
data
- is the string to be send.sender
- is the TCP client exception.public void ReplyToAllExceptSender(byte[] bytes, int offset, int length, TCPClientConnection sender)
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.sender
- is the TCP client exception.public java.net.ServerSocket getServerSocket()
public void setMyExtasysTCPServer(ExtasysTCPServer server)
server
- is the ExtasysTCPServer main reference at witch this
TCPListener belongs.public ExtasysTCPServer getMyExtasysTCPServer()
public boolean isActive()
public java.lang.String getName()
public java.net.InetAddress getIPAddress()
public int getPort()
public java.util.Hashtable getConnectedClients()
public int getMaxConnections()
public void setMaxConnections(int value)
value
- is the maximum allowed connections of this listener.public int getReadBufferSize()
public void setReadBufferSize(int value)
value
- is the read buffer size in bytes.public int getConnectionTimeOut()
public void setConnectionTimeOut(int value)
value
- is the connections time-out in milliseconds of this listener.public int getBytesIn()
public int getBytesOut()
public boolean isMessageCollectorInUse()
public java.lang.String getMessageSplitter()