org.apache.commons.net
public final class EchoUDPClient extends DiscardUDPClient
open
and call send
to send datagrams to the server,
then call receive
to receive echoes.
After you're done echoing data, call
close()
to clean up properly.
See Also: EchoTCPClient
Field Summary | |
---|---|
static int | DEFAULT_PORT The default echo port. |
Method Summary | |
---|---|
int | receive(byte[] data, int length)
Receives echoed data and returns its length. |
int | receive(byte[] data) Same as receive(data, data.length) ** |
void | send(byte[] data, int length, InetAddress host)
Sends the specified data to the specified server at the default echo
port.
|
void | send(byte[] data, InetAddress host) Same as send(data, data.length, host) ** |
Returns: Length of actual data received.
Throws: IOException If an error occurs while receiving the data.
receive(data, data.length)
**Parameters: data The echo data to send. length The length of the data to send. Should be less than or equal to the length of the data byte array. host The address of the server.
Throws: IOException If an error occurs during the datagram send operation.
send(data, data.length, host)
**