public class UDPSocket extends java.lang.Object implements IUDPSocket
DatagramSocket implementation for the IUDPSocket interface.| Constructor and Description |
|---|
UDPSocket(ServerAddress serverAddress,
int readTimeout) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
connect()
Connect the socket to the server.
|
byte[] |
receive(int bufferSize)
Receive data from the socket.
|
void |
send(byte[] data)
Send the given data to the target address.
|
public UDPSocket(ServerAddress serverAddress, int readTimeout)
public void connect()
throws java.io.IOException
IUDPSocketconnect in interface IUDPSocketjava.io.IOException - If an I/O error occurspublic void send(byte[] data)
throws java.io.IOException
IUDPSocketsend in interface IUDPSocketdata - The data to sendjava.io.IOException - If an I/O error occurspublic byte[] receive(int bufferSize)
throws java.io.IOException
IUDPSocketreceive in interface IUDPSocketbufferSize - The buffer sizejava.io.IOException - If an I/O error occurspublic void close()
throws java.io.IOException
close in interface java.lang.AutoCloseablejava.io.IOException