S
- the type to send over UDPpublic class UDPSender<S extends java.io.Serializable>
extends java.lang.Object
Constructor and Description |
---|
UDPSender(java.lang.String IPAddress,
int port) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the connection
|
void |
send(S data)
Sends an object over UDP.
|
public UDPSender(java.lang.String IPAddress, int port) throws java.net.UnknownHostException, java.net.SocketException
IPAddress
- the IP to send toport
- the port to connect tojava.net.UnknownHostException
- if the host could not be foundjava.net.SocketException
- if the connection could not be establishedpublic void close()
public void send(S data) throws java.io.IOException
data
- the data to sendjava.io.IOException
- if the data could not be sent