FileDocCategorySizeDatePackage
DiscardUDPClient.javaAPI DocApache Commons NET 1.4.1 API2875Sat Dec 03 10:05:50 GMT 2005org.apache.commons.net

DiscardUDPClient

public 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.

author
Daniel F. Savarese
see
DiscardTCPClient

Fields Summary
public static final int
DEFAULT_PORT
The 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 voidsend(byte[] data, int length, java.net.InetAddress host, int port)
Sends the specified data to the specified server at the specified port.

param
data The discard data to send.
param
length The length of the data to send. Should be less than or equal to the length of the data byte array.
param
host The address of the server.
param
port The service port.
exception
IOException If an error occurs during the datagram send operation.

        _sendPacket.setData(data);
        _sendPacket.setLength(length);
        _sendPacket.setAddress(host);
        _sendPacket.setPort(port);
        _socket_.send(_sendPacket);
    
public voidsend(byte[] data, int length, java.net.InetAddress host)
Same as send(data, length, host. DiscardUDPClient.DEFAULT_PORT).

        send(data, length, host, DEFAULT_PORT);
    
public voidsend(byte[] data, java.net.InetAddress host)
Same as send(data, data.length, host. DiscardUDPClient.DEFAULT_PORT).

        send(data, data.length, host, DEFAULT_PORT);