public final class EchoUDPClient extends DiscardUDPClient
EchoTCPClient,
DiscardUDPClient| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_PORT
The default echo port.
|
_isOpen_, _socket_, _socketFactory_, _timeout_| Constructor and Description |
|---|
EchoUDPClient() |
| Modifier and Type | Method and Description |
|---|---|
int |
receive(byte[] data)
Same as
receive(data, data.length) |
int |
receive(byte[] data,
int length)
Receives echoed data and returns its length.
|
void |
send(byte[] data,
java.net.InetAddress host)
Same as
send(data, data.length, host) |
void |
send(byte[] data,
int length,
java.net.InetAddress host)
Sends the specified data to the specified server at the default echo
port.
|
sendclose, getDefaultTimeout, getLocalAddress, getLocalPort, getSoTimeout, isOpen, open, open, open, setDatagramSocketFactory, setDefaultTimeout, setSoTimeoutpublic static final int DEFAULT_PORT
public void send(byte[] data,
int length,
java.net.InetAddress host)
throws java.io.IOException
send in class DiscardUDPClientdata - 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.java.io.IOException - If an error occurs during the datagram send
operation.public void send(byte[] data,
java.net.InetAddress host)
throws java.io.IOException
send(data, data.length, host) send in class DiscardUDPClientjava.io.IOExceptionpublic int receive(byte[] data,
int length)
throws java.io.IOException
java.io.IOException - If an error occurs while receiving the data.public int receive(byte[] data)
throws java.io.IOException
receive(data, data.length)java.io.IOExceptionCopyright © 1997-2002 Daniel F. Savarese. All Rights Reserved.