java.lang.Object | |
↳ | java.net.DatagramSocketImpl |
Abstract datagram and multicast socket implementation base class.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
java.net.SocketOptions
|
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
fd | The file descriptor object. | ||||||||||
localPort | The local port number. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Binds a datagram socket to a local port and address.
| |||||||||||
Close the socket.
| |||||||||||
Connects a datagram socket to a remote destination.
| |||||||||||
Creates a datagram socket.
| |||||||||||
Disconnects a datagram socket from its remote destination.
| |||||||||||
Gets the datagram socket file descriptor.
| |||||||||||
Gets the local port.
| |||||||||||
This method is deprecated.
use getTimeToLive instead.
| |||||||||||
Retrieve the TTL (time-to-live) option.
| |||||||||||
Join the multicast group.
| |||||||||||
Join the multicast group.
| |||||||||||
Leave the multicast group.
| |||||||||||
Leave the multicast group.
| |||||||||||
Peek at the packet to see who it is from.
| |||||||||||
Peek at the packet to see who it is from.
| |||||||||||
Receive the datagram packet.
| |||||||||||
Sends a datagram packet.
| |||||||||||
This method is deprecated.
use setTimeToLive instead.
| |||||||||||
Set the TTL (time-to-live) option.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
java.net.SocketOptions
|
The file descriptor object.
The local port number.
Binds a datagram socket to a local port and address.
lport | the local port |
---|---|
laddr | the local address |
SocketException | if there is an error in the underlying protocol, such as a TCP error. |
---|
Close the socket.
Connects a datagram socket to a remote destination. This associates the remote address with the local socket so that datagrams may only be sent to this destination and received from this destination. This may be overridden to call a native system connect.
If the remote destination to which the socket is connected does not exist, or is otherwise unreachable, and if an ICMP destination unreachable packet has been received for that address, then a subsequent call to send or receive may throw a PortUnreachableException. Note, there is no guarantee that the exception will be thrown.
address | the remote InetAddress to connect to |
---|---|
port | the remote port number |
SocketException | may be thrown if the socket cannot be connected to the remote destination |
---|
Creates a datagram socket.
SocketException | if there is an error in the underlying protocol, such as a TCP error. |
---|
Disconnects a datagram socket from its remote destination.
Gets the datagram socket file descriptor.
Gets the local port.
This method is deprecated.
use getTimeToLive instead.
Retrieve the TTL (time-to-live) option.
IOException | if an I/O exception occurs while retrieving the time-to-live option |
---|
Retrieve the TTL (time-to-live) option.
IOException | if an I/O exception occurs while retrieving the time-to-live option |
---|
Join the multicast group.
inetaddr | multicast address to join. |
---|
IOException | if an I/O exception occurs while joining the multicast group. |
---|
Join the multicast group.
mcastaddr | address to join. |
---|---|
netIf | specifies the local interface to receive multicast datagram packets |
IOException | if an I/O exception occurs while joining the multicast group |
---|
Leave the multicast group.
inetaddr | multicast address to leave. |
---|
IOException | if an I/O exception occurs while leaving the multicast group. |
---|
Leave the multicast group.
mcastaddr | address to leave. |
---|---|
netIf | specified the local interface to leave the group at |
IOException | if an I/O exception occurs while leaving the multicast group |
---|
Peek at the packet to see who it is from. Updates the specified InetAddress
to the address which the packet came from.
i | an InetAddress object |
---|
IOException | if an I/O exception occurs |
---|---|
PortUnreachableException | may be thrown if the socket is connected to a currently unreachable destination. Note, there is no guarantee that the exception will be thrown. |
Peek at the packet to see who it is from. The data is copied into the specified
DatagramPacket
. The data is returned,
but not consumed, so that a subsequent peekData/receive operation
will see the same data.
p | the Packet Received. |
---|
IOException | if an I/O exception occurs |
---|---|
PortUnreachableException | may be thrown if the socket is connected to a currently unreachable destination. Note, there is no guarantee that the exception will be thrown. |
Receive the datagram packet.
p | the Packet Received. |
---|
IOException | if an I/O exception occurs while receiving the datagram packet. |
---|---|
PortUnreachableException | may be thrown if the socket is connected to a currently unreachable destination. Note, there is no guarantee that the exception will be thrown. |
Sends a datagram packet. The packet contains the data and the destination address to send the packet to.
p | the packet to be sent. |
---|
IOException | if an I/O exception occurs while sending the datagram packet. |
---|---|
PortUnreachableException | may be thrown if the socket is connected to a currently unreachable destination. Note, there is no guarantee that the exception will be thrown. |
This method is deprecated.
use setTimeToLive instead.
Set the TTL (time-to-live) option.
ttl | a byte specifying the TTL value |
---|
IOException | if an I/O exception occurs while setting the time-to-live option. |
---|
Set the TTL (time-to-live) option.
ttl | an int specifying the time-to-live value |
---|
IOException | if an I/O exception occurs while setting the time-to-live option. |
---|