DiscardUDPClientpublic class DiscardUDPClient extends DatagramSocketClient The DiscardUDPClient class is a UDP implementation of a client for the
Discard protocol described in RFC 863. To use the class,
just open a local UDP port
with {@link org.apache.commons.net.DatagramSocketClient#open open }
and call {@link #send send } to send datagrams to the server
After you're done sending discard data, call
{@link org.apache.commons.net.DatagramSocketClient#close close() }
to clean up properly.
|
Fields Summary |
---|
public static final int | DEFAULT_PORTThe default discard port. It is set to 9 according to RFC 863. | DatagramPacket | _sendPacket |
Constructors Summary |
---|
public DiscardUDPClient()
_sendPacket = new DatagramPacket(new byte[0], 0);
|
Methods Summary |
---|
public void | send(byte[] data, int length, java.net.InetAddress host, int port)Sends the specified data to the specified server at the specified port.
_sendPacket.setData(data);
_sendPacket.setLength(length);
_sendPacket.setAddress(host);
_sendPacket.setPort(port);
_socket_.send(_sendPacket);
| public void | send(byte[] data, int length, java.net.InetAddress host)Same as
send(data, length, host. DiscardUDPClient.DEFAULT_PORT) .
send(data, length, host, DEFAULT_PORT);
| public void | send(byte[] data, java.net.InetAddress host)Same as
send(data, data.length, host. DiscardUDPClient.DEFAULT_PORT) .
send(data, data.length, host, DEFAULT_PORT);
|
|