| java.lang.Object java.net.DatagramSocketImpl
All known Subclasses: java.net.PlainDatagramSocketImpl,
DatagramSocketImpl | abstract public class DatagramSocketImpl implements SocketOptions(Code) | | Abstract datagram and multicast socket implementation base class.
author: Pavani Diwanji since: JDK1.1 |
Method Summary | |
abstract protected void | bind(int lport, InetAddress laddr) Binds a datagram socket to a local port and address. | abstract protected void | close() Close the socket. | protected void | connect(InetAddress address, int port) Connects a datagram socket to a remote destination. | abstract protected void | create() Creates a datagram socket.
exception: SocketException - if there is an error in the underlying protocol, such as a TCP error. | protected void | disconnect() Disconnects a datagram socket from its remote destination. | protected FileDescriptor | getFileDescriptor() Gets the datagram socket file descriptor. | protected int | getLocalPort() Gets the local port. | abstract protected int | getTimeToLive() Retrieve the TTL (time-to-live) option. | abstract protected void | join(InetAddress inetaddr) Join the multicast group. | abstract protected void | joinGroup(SocketAddress mcastaddr, NetworkInterface netIf) Join the multicast group. | abstract protected void | leave(InetAddress inetaddr) Leave the multicast group. | abstract protected void | leaveGroup(SocketAddress mcastaddr, NetworkInterface netIf) Leave the multicast group. | abstract protected int | peek(InetAddress i) Peek at the packet to see who it is from.
Parameters: i - an InetAddress object the address which the packet came from. exception: IOException - if an I/O exception occurs exception: PortUnreachableException - may be thrown if the socket is connectedto a currently unreachable destination. | abstract protected int | peekData(DatagramPacket p) Peek at the packet to see who it is from. | abstract protected void | receive(DatagramPacket p) Receive the datagram packet.
Parameters: p - the Packet Received. exception: IOException - if an I/O exception occurswhile receiving the datagram packet. exception: PortUnreachableException - may be thrown if the socket is connectedto a currently unreachable destination. | abstract protected void | send(DatagramPacket p) Sends a datagram packet. | abstract protected void | setTimeToLive(int ttl) Set the TTL (time-to-live) option. |
localPort | protected int localPort(Code) | | The local port number.
|
bind | abstract protected void bind(int lport, InetAddress laddr) throws SocketException(Code) | | Binds a datagram socket to a local port and address.
Parameters: lport - the local port Parameters: laddr - the local address exception: SocketException - if there is an error in theunderlying protocol, such as a TCP error. |
close | abstract protected void close()(Code) | | Close the socket.
|
connect | protected void connect(InetAddress address, int port) throws SocketException(Code) | | 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.
Parameters: address - the remote InetAddress to connect to Parameters: port - the remote port number exception: SocketException - may be thrown if the socket cannot beconnected to the remote destination since: 1.4 |
create | abstract protected void create() throws SocketException(Code) | | Creates a datagram socket.
exception: SocketException - if there is an error in the underlying protocol, such as a TCP error. |
disconnect | protected void disconnect()(Code) | | Disconnects a datagram socket from its remote destination.
since: 1.4 |
getFileDescriptor | protected FileDescriptor getFileDescriptor()(Code) | | Gets the datagram socket file descriptor.
a FileDescriptor object representing the datagram socketfile descriptor |
getLocalPort | protected int getLocalPort()(Code) | | Gets the local port.
an int representing the local port value |
join | abstract protected void join(InetAddress inetaddr) throws IOException(Code) | | Join the multicast group.
Parameters: inetaddr - multicast address to join. exception: IOException - if an I/O exception occurswhile joining the multicast group. |
joinGroup | abstract protected void joinGroup(SocketAddress mcastaddr, NetworkInterface netIf) throws IOException(Code) | | Join the multicast group.
Parameters: mcastaddr - address to join. Parameters: netIf - specifies the local interface to receive multicastdatagram packets throws: IOException - if an I/O exception occurs while joiningthe multicast group since: 1.4 |
leave | abstract protected void leave(InetAddress inetaddr) throws IOException(Code) | | Leave the multicast group.
Parameters: inetaddr - multicast address to leave. exception: IOException - if an I/O exception occurswhile leaving the multicast group. |
leaveGroup | abstract protected void leaveGroup(SocketAddress mcastaddr, NetworkInterface netIf) throws IOException(Code) | | Leave the multicast group.
Parameters: mcastaddr - address to leave. Parameters: netIf - specified the local interface to leave the group at throws: IOException - if an I/O exception occurs while leavingthe multicast group since: 1.4 |
peek | abstract protected int peek(InetAddress i) throws IOException(Code) | | Peek at the packet to see who it is from.
Parameters: i - an InetAddress object the address which the packet came from. exception: IOException - if an I/O exception occurs exception: PortUnreachableException - may be thrown if the socket is connectedto a currently unreachable destination. Note, there is no guarantee that theexception will be thrown. |
peekData | abstract protected int peekData(DatagramPacket p) throws IOException(Code) | | Peek at the packet to see who it is from. The data is returned,
but not consumed, so that a subsequent peekData/receive operation
will see the same data.
Parameters: p - the Packet Received. the address which the packet came from. exception: IOException - if an I/O exception occurs exception: PortUnreachableException - may be thrown if the socket is connectedto a currently unreachable destination. Note, there is no guarantee that theexception will be thrown. since: 1.4 |
receive | abstract protected void receive(DatagramPacket p) throws IOException(Code) | | Receive the datagram packet.
Parameters: p - the Packet Received. exception: IOException - if an I/O exception occurswhile receiving the datagram packet. exception: PortUnreachableException - may be thrown if the socket is connectedto a currently unreachable destination. Note, there is no guarantee that theexception will be thrown. |
send | abstract protected void send(DatagramPacket p) throws IOException(Code) | | Sends a datagram packet. The packet contains the data and the
destination address to send the packet to.
Parameters: p - the packet to be sent. exception: IOException - if an I/O exception occurs while sending the datagram packet. exception: PortUnreachableException - may be thrown if the socket is connectedto a currently unreachable destination. Note, there is no guarantee that the exception will be thrown. |
setTimeToLive | abstract protected void setTimeToLive(int ttl) throws IOException(Code) | | Set the TTL (time-to-live) option.
Parameters: ttl - an int specifying the time-to-live value exception: IOException - if an I/O exception occurswhile setting the time-to-live option. See Also: DatagramSocketImpl.getTimeToLive() |
|
|