public class ExtasysUDPServer
extends java.lang.Object
Constructor and Description |
---|
ExtasysUDPServer(java.lang.String name,
java.lang.String description,
int corePoolSize,
int maximumPoolSize)
Constructs a new Extasys UDP Server.
|
Modifier and Type | Method and Description |
---|---|
UDPListener |
AddListener(java.lang.String name,
java.net.InetAddress ipAddress,
int port,
int readBufferSize,
int readDataTimeOut)
Add a new listener to this server.
|
void |
Dispose()
Dispose the server.
|
int |
getBytesIn()
Returns the total bytes received from this server.
|
int |
getBytesOut()
Returns the total bytes send from this server.
|
java.lang.String |
getDescription()
Returns the description of this server.
|
java.util.ArrayList |
getListeners()
Returns an ArrayList with this server's tcp listeners.
|
java.util.concurrent.ThreadPoolExecutor |
getMyThreadPool()
Returns this server's thread pool.
|
java.lang.String |
getName()
Returns the name of this server.
|
void |
OnDataReceive(UDPListener listener,
java.net.DatagramPacket packet) |
void |
RemoveListener(java.lang.String name)
Stops and removes a UDP listener from this server.
|
void |
SendData(java.net.DatagramPacket packet)
Send data.
|
void |
Start()
Start or restart the server.
|
void |
Stop()
Stop the server.
|
public ExtasysUDPServer(java.lang.String name, java.lang.String description, int corePoolSize, int maximumPoolSize)
name
- is the name of the server.description
- is the description of the server.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 UDPListener AddListener(java.lang.String name, java.net.InetAddress ipAddress, int port, int readBufferSize, int readDataTimeOut)
name
- is the listener's name.ipAddress
- is the listener's IP address.port
- is the listener's udp port.readBufferSize
- is the maximum size of bytes the listener can use to read incoming bytes at a time.readDataTimeOut
- is the maximum time in milliseconds a client can use to send data to the listener.public void RemoveListener(java.lang.String name)
name
- is the name of the UDP listener.public void SendData(java.net.DatagramPacket packet)
packet
- is the DatagramPacket to send.public void Start() throws java.net.SocketException
java.net.SocketException
public void Stop()
public void Dispose()
public void OnDataReceive(UDPListener listener, java.net.DatagramPacket packet)
public java.lang.String getName()
public java.lang.String getDescription()
public java.util.ArrayList getListeners()
public java.util.concurrent.ThreadPoolExecutor getMyThreadPool()
public int getBytesIn()
public int getBytesOut()