Package org.apache.commons.net.discard
Class DiscardUDPClient
- java.lang.Object
-
- org.apache.commons.net.DatagramSocketClient
-
- org.apache.commons.net.discard.DiscardUDPClient
-
- Direct Known Subclasses:
EchoUDPClient
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 withopen
and callsend
to send datagrams to the server After you're done sending discard data, callclose()
to clean up properly.- See Also:
DiscardTCPClient
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_PORT
The default discard port.-
Fields inherited from class org.apache.commons.net.DatagramSocketClient
_isOpen_, _socket_, _socketFactory_, _timeout_
-
-
Constructor Summary
Constructors Constructor Description DiscardUDPClient()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
send(byte[] data, int length, java.net.InetAddress host)
Same assend(data, length, host.
void
send(byte[] data, int length, java.net.InetAddress host, int port)
Sends the specified data to the specified server at the specified port.void
send(byte[] data, java.net.InetAddress host)
Same assend(data, data.length, host.
-
Methods inherited from class org.apache.commons.net.DatagramSocketClient
close, getCharset, getCharsetName, getDefaultTimeout, getLocalAddress, getLocalPort, getSoTimeout, isOpen, open, open, open, setCharset, setDatagramSocketFactory, setDefaultTimeout, setSoTimeout
-
-
-
-
Field Detail
-
DEFAULT_PORT
public static final int DEFAULT_PORT
The default discard port. It is set to 9 according to RFC 863.- See Also:
- Constant Field Values
-
-
Method Detail
-
send
public void send(byte[] data, int length, java.net.InetAddress host, int port) throws java.io.IOException
Sends the specified data to the specified server at the specified port.- Parameters:
data
- The discard 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.port
- The service port.- Throws:
java.io.IOException
- If an error occurs during the datagram send operation.
-
send
public void send(byte[] data, int length, java.net.InetAddress host) throws java.io.IOException
Same assend(data, length, host. DiscardUDPClient.DEFAULT_PORT)
.- Parameters:
data
- the buffer to sendlength
- the length of the data in the bufferhost
- the target host- Throws:
java.io.IOException
- if an error occurs- See Also:
send(byte[], int, InetAddress, int)
-
send
public void send(byte[] data, java.net.InetAddress host) throws java.io.IOException
Same assend(data, data.length, host. DiscardUDPClient.DEFAULT_PORT)
.- Parameters:
data
- the buffer to sendhost
- the target host- Throws:
java.io.IOException
- if an error occurs- See Also:
send(byte[], int, InetAddress, int)
-
-