public abstract class DatagramSocketImpl extends Object implements SocketOptions
Written using on-line Java Platform 1.2 API Specification, as well as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
Status: Believed complete and correct.
| Modifier and Type | Field and Description |
|---|---|
protected FileDescriptor |
fd
The FileDescriptor object for this object.
|
protected int |
localPort
The local port to which this socket is bound
|
IP_MULTICAST_IF, IP_MULTICAST_IF2, IP_MULTICAST_LOOP, IP_TOS, SO_BINDADDR, SO_BROADCAST, SO_KEEPALIVE, SO_LINGER, SO_OOBINLINE, SO_RCVBUF, SO_REUSEADDR, SO_SNDBUF, SO_TIMEOUT, TCP_NODELAY| Constructor and Description |
|---|
DatagramSocketImpl()
Default, no-argument constructor for subclasses to call.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
bind(int lport,
InetAddress laddr)
This method binds the socket to the specified local port and address.
|
protected abstract void |
close()
This methods closes the socket
|
protected void |
connect(InetAddress address,
int port)
Connects the socket to a host specified by address and port.
|
protected abstract void |
create()
Creates a new datagram socket.
|
protected void |
disconnect()
Disconnects the socket.
|
protected FileDescriptor |
getFileDescriptor()
Returns the FileDescriptor for this socket
|
protected int |
getLocalPort()
Returns the local port this socket is bound to
|
protected abstract int |
getTimeToLive()
This method returns the current Time to Live (TTL) setting on this
socket.
|
protected abstract byte |
getTTL()
Deprecated.
// FIXME: when ?
|
protected abstract void |
join(InetAddress inetaddr)
Causes this socket to join the specified multicast group
|
protected abstract void |
joinGroup(SocketAddress mcastaddr,
NetworkInterface netIf)
Causes this socket to join the specified multicast group on a specified
device
|
protected abstract void |
leave(InetAddress inetaddr)
Causes the socket to leave the specified multicast group.
|
protected abstract void |
leaveGroup(SocketAddress mcastaddr,
NetworkInterface netIf)
Leaves a multicast group
|
protected abstract int |
peek(InetAddress i)
Takes a peek at the next packet received in order to retrieve the
address of the sender
|
protected abstract int |
peekData(DatagramPacket p)
Takes a peek at the next packet received.
|
protected abstract void |
receive(DatagramPacket p)
Receives a packet of data from the network Will block until a packet
arrives.
|
protected abstract void |
send(DatagramPacket p)
Transmits the specified packet of data to the network.
|
protected abstract void |
setTimeToLive(int ttl)
Sets the Time to Live (TTL) setting on this socket to the specified
value.
|
protected abstract void |
setTTL(byte ttl)
Deprecated.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetOption, setOptionprotected int localPort
protected FileDescriptor fd
public DatagramSocketImpl()
protected abstract void bind(int lport, InetAddress laddr) throws SocketException
lport - The port number to bind toladdr - The address to bind toSocketException - If an error occursprotected abstract void close()
protected abstract void create() throws SocketException
SocketException - If an error occursprotected abstract int peek(InetAddress i) throws IOException
i - The InetAddress to fill in with the information
about the sender if the next packetIOException - If an error occursPortUnreachableException - May be thrown if the socket is
connected to a currently unreachable destination. Note, there is no
guarantee that the exception will be thrown.protected abstract int peekData(DatagramPacket p) throws IOException
p - The DatagramPacket to fill in with the data sent.IOException - If an error occursPortUnreachableException - May be thrown if the socket is
connected to a currently unreachable destination. Note, there is no
guarantee that the exception will be thrown.protected abstract void send(DatagramPacket p) throws IOException
p - The packet to sendIOException - If an error occursPortUnreachableException - May be thrown if the socket is
connected to a currently unreachable destination. Note, there is no
guarantee that the exception will be thrown.protected abstract void receive(DatagramPacket p) throws IOException
DatagramPacket object.p - A place to store the incoming packet.IOException - If an error occursPortUnreachableException - May be thrown if the socket is
connected to a currently unreachable destination. Note, there is no
guarantee that the exception will be thrown.protected void connect(InetAddress address, int port) throws SocketException
address - The InetAddress of the host to connect toport - The port number of the host to connect toSocketException - If an error occursprotected void disconnect()
protected abstract void setTTL(byte ttl) throws IOException
setTimeToLive(int) instead.ttl - The new Time to Live valueIOException - If an error occursprotected abstract byte getTTL() throws IOException
getTimeToLive() instead.IOException - If an error occursprotected abstract void setTimeToLive(int ttl) throws IOException
ttl - The new Time to Live valueIOException - If an error occursprotected abstract int getTimeToLive() throws IOException
IOException - If an error occursprotected abstract void join(InetAddress inetaddr) throws IOException
inetaddr - The multicast address to join withIOException - If an error occursprotected abstract void leave(InetAddress inetaddr) throws IOException
inetaddr - The multicast address to leaveIOException - If an error occursprotected abstract void joinGroup(SocketAddress mcastaddr, NetworkInterface netIf) throws IOException
mcastaddr - The address to leavenetIf - The specified network interface to join the group atIOException - If an error occursprotected abstract void leaveGroup(SocketAddress mcastaddr, NetworkInterface netIf) throws IOException
mcastaddr - The address to joinnetIf - The specified network interface to leave the group atIOException - If an error occursprotected FileDescriptor getFileDescriptor()
protected int getLocalPort()