Inherited by seda.nbio.NonblockingMulticastSocket.
Public Member Functions | |
NonblockingDatagramSocket () throws IOException | |
Create a NonblockingDatagramSocket bound to any available port. | |
NonblockingDatagramSocket (int port) throws IOException | |
Create a NonblockingDatagramSocket bound to the given port. | |
NonblockingDatagramSocket (int port, InetAddress laddr) throws IOException | |
Create a NonblockingDatagramSocket bound to the given port and the given local address. | |
synchronized void | close () |
Close this NonblockingDatagramSocket. | |
void | connect (InetAddress address, int port) throws IllegalArgumentException |
Connect this NonblockingDatagramSocket to the given address and port. | |
void | connect (String host, int port) throws UnknownHostException |
synchronized void | disconnect () |
InetAddress | getInetAddress () |
Return the remote address to which this socket is bound. | |
InetAddress | getLocalAddress () |
Return the local address to which this socket is bound. | |
int | getPort () |
Return the remote port to which this socket is bound. | |
int | getLocalPort () |
Return the local port to which this socket is bound. | |
int | nbReceive (DatagramPacket p) throws IOException |
Receive a datagram from this socket. | |
int | nbReceive (byte[] data, int offset, int length) throws IOException |
Receive a datagram from this socket. | |
int | nbSend (DatagramPacket p) throws IOException |
Sends a datagram packet from this socket. | |
int | nbSend (byte[] data, int offset, int length, InetAddress addr, int port) throws IOException |
Sends a datagram packet from this socket. | |
int | nbSend (byte[] data, int offset, int length) throws IOException |
Sends a datagram packet from this socket. | |
int | getReceiveBufferSize () throws SocketException |
int | getSendBufferSize () throws SocketException |
void | setReceiveBufferSize (int size) throws SocketException |
void | setSendBufferSize (int size) throws SocketException |
void | send (DatagramPacket p) throws IOException |
This method is provided for convenience and mimics blocking behavior by invoking the nonblocking nbSend() operation. | |
void | receive (DatagramPacket p) throws IOException |
This method is provided for convenience and mimics blocking behavior by invoking the nonblocking nbReceive() operation. | |
Static Package Functions | |
[static initializer] | |
Package Attributes | |
NonblockingSocketImpl | impl |
boolean | is_connected |
|
Create a NonblockingDatagramSocket bound to any available port.
|
|
Create a NonblockingDatagramSocket bound to the given port.
|
|
Create a NonblockingDatagramSocket bound to the given port and the given local address.
|
|
|
|
Close this NonblockingDatagramSocket.
|
|
|
|
Connect this NonblockingDatagramSocket to the given address and port. All send() operations with a NULL 'sendTo' address will now send to this address by default. You may call connect() multiple times on a NonblockingDatagramSocket to change the default send address. |
|
|
|
Return the remote address to which this socket is bound. Should be null if the socket hasn't been connected to anything. |
|
Return the local address to which this socket is bound.
|
|
Return the local port to which this socket is bound.
|
|
Return the remote port to which this socket is bound.
|
|
|
|
|
|
Receive a datagram from this socket. When this method returns, the given byte array is filled with the data received starting at the given offset with the given length. If the message is longer than the given length, the message is truncated. This method does not block if a datagram is not ready to be received.
|
|
Receive a datagram from this socket. When this method returns, the DatagramPacket's buffer is filled with the data received. The datagram packet also contains the sender's IP address, and the port number on the sender's machine. This method does not block if a datagram is not ready to be received. The length field of the datagram packet object contains the length of the received message, or is set to 0 if no packet was received. If the message is longer than the packet's length, the message is truncated.
|
|
Sends a datagram packet from this socket. This method constructs a temporary DatagramPacket from the given data, offset, and length. This method may only be called on a connected socket; if called on an unconnected socket, an IllegalArgumentException is thrown. This method does not block; it returns 0 if the packet could not be sent.
|
|
Sends a datagram packet from this socket. This method constructs a temporary DatagramPacket from the given data, offset, length, address, and port, and calls nbSend(DatagramPacket p). This method does not block; it returns 0 if the packet could not be sent.
|
|
Sends a datagram packet from this socket. The DatagramPacket includes information indicating the data to be sent, its length, the IP address of the remote host, and the port number on the remote host. This method does not block; it returns 0 if the packet could not be sent.
|
|
This method is provided for convenience and mimics blocking behavior by invoking the nonblocking nbReceive() operation. If no packet could be immediately received it returns immediately with a received packet length of 0. Use of this method is not recommended and is provided only for compatibility with java.net.DatagramSocket. |
|
This method is provided for convenience and mimics blocking behavior by invoking the nonblocking nbSend() operation. If the packet could not be immediately sent it is simply dropped (because this is a UDP socket this behavior is consistent with the lack of reliability in UDP). Use of this method is not recommended and is provided only for compatibility with java.net.DatagramSocket. |
|
|
|
|
|
|
|
|