public class UDPConnector
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
int |
fBytesIn |
int |
fBytesOut |
IncomingUDPClientPacket |
fLastIncomingPacket |
OutgoingUDPClientPacket |
fLastOutgoingPacket |
java.net.DatagramSocket |
fSocket |
Constructor and Description |
---|
UDPConnector(ExtasysUDPClient myClient,
java.lang.String name,
int readBufferSize,
int readTimeOut,
java.net.InetAddress serverIP,
int serverPort)
Constructs a new UDP Connector.
|
Modifier and Type | Method and Description |
---|---|
int |
getBytesIn()
Return the number of bytes received from this connector.
|
int |
getBytesOut()
Return the number of bytes send from this connector.
|
ExtasysUDPClient |
getMyExtasysUDPClient()
Returns the main Extasys UDP Client of the connector.
|
java.lang.String |
getName()
Returns the name of this connector.
|
int |
getReadBufferSize()
Returns the read buffer size of the connection.
|
int |
getReadTimeOut()
Returns the maximum time in milliseconds in wich a datagram packet can be received.
|
boolean |
isActive() |
void |
SendData(byte[] bytes,
int offset,
int length)
Send data to host.
|
void |
SendData(java.lang.String data)
Send data to all host.
|
void |
Start()
Start the udp connector.
|
void |
Stop()
Stop the udp connector.
|
public java.net.DatagramSocket fSocket
public int fBytesIn
public int fBytesOut
public IncomingUDPClientPacket fLastIncomingPacket
public OutgoingUDPClientPacket fLastOutgoingPacket
public UDPConnector(ExtasysUDPClient myClient, java.lang.String name, int readBufferSize, int readTimeOut, java.net.InetAddress serverIP, int serverPort)
myClient
- is the connectors main Extasys UDP Client.name
- is the name of the connector.readBufferSize
- is the maximum number of bytes the socket can read at a time.readTimeOut
- is the maximum time in milliseconds in wich a datagram packet can be received. Set to 0 for no time-out.serverIP
- is the server's ip address the connector will use to send data.serverPort
- is the server's udp port.public void Start() throws java.net.SocketException, java.lang.Exception
java.net.SocketException
java.lang.Exception
public void Stop()
public void SendData(java.lang.String data) throws java.io.IOException
data
- is the string to be send.java.io.IOException
public void SendData(byte[] bytes, int offset, int length) throws java.io.IOException
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.java.io.IOException
public boolean isActive()
public ExtasysUDPClient getMyExtasysUDPClient()
public java.lang.String getName()
public int getReadBufferSize()
public int getReadTimeOut()
public int getBytesIn()
public int getBytesOut()