| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public abstract class DatagramSocketImpl extends Object implements SocketOptions
Abstract datagram and multicast socket implementation base class.
Field Summary | |
---|---|
protected FileDescriptor |
fd
The file descriptor object. |
protected int |
localPort
The local port number. |
Constructor Summary | |
---|---|
|
Method Summary | |
---|---|
protected abstract void |
bind(int lport, InetAddress laddr) Binds a datagram socket to a local port and address. |
protected abstract void |
close() Close the socket. |
protected void |
connect(InetAddress address, int port) Connects a datagram socket to a remote destination. |
protected abstract void |
create() Creates a datagram socket. |
protected void |
Disconnects a datagram socket from its remote destination. |
protected FileDescriptor |
Gets the datagram socket file descriptor. |
protected int |
Gets the local port. |
protected abstract int |
Retrieve the TTL (time-to-live) option. |
protected abstract byte |
getTTL() Retrieve the TTL (time-to-live) option. |
protected abstract void |
join(InetAddress inetaddr) Join the multicast group. |
protected abstract void |
joinGroup(SocketAddress mcastaddr, NetworkInterface netIf) Join the multicast group. |
protected abstract void |
leave(InetAddress inetaddr) Leave the multicast group. |
protected abstract void |
leaveGroup(SocketAddress mcastaddr, NetworkInterface netIf) Leave the multicast group. |
protected abstract int |
peek(InetAddress i) Peek at the packet to see who it is from. |
protected abstract int |
Peek at the packet to see who it is from. |
protected abstract void |
Receive the datagram packet. |
protected abstract void |
Sends a datagram packet. |
protected abstract void |
setTimeToLive(int ttl) Set the TTL (time-to-live) option. |
protected abstract void |
setTTL(byte ttl) Set the TTL (time-to-live) option. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected FileDescriptor fd
protected int localPort
Constructor Detail |
---|
public DatagramSocketImpl()
Method Detail |
---|
protected abstract void bind(int lport, InetAddress laddr) throws SocketException
lport
- the local portladdr
- the local addressSocketException
- if there is an error in the
underlying protocol, such as a TCP error.protected abstract void close()
protected void connect(InetAddress address, int port) throws SocketException
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 toport
- the remote port numberSocketException
- may be thrown if the socket cannot be
connected to the remote destinationprotected abstract void create() throws SocketException
SocketException
- if there is an error in the
underlying protocol, such as a TCP error.protected void disconnect()
protected FileDescriptor getFileDescriptor()
protected int getLocalPort()
protected abstract int getTimeToLive() throws IOException
IOException
- if an I/O exception occurs
while retrieving the time-to-live optionprotected abstract byte getTTL() throws IOException
IOException
- if an I/O exception occurs
while retrieving the time-to-live optionprotected abstract void join(InetAddress inetaddr) throws IOException
inetaddr
- multicast address to join.IOException
- if an I/O exception occurs
while joining the multicast group.protected abstract void joinGroup(SocketAddress mcastaddr, NetworkInterface netIf) throws IOException
mcastaddr
- address to join.netIf
- specifies the local interface to receive multicast
datagram packetsIOException
- if an I/O exception occurs while joining
the multicast groupprotected abstract void leave(InetAddress inetaddr) throws IOException
inetaddr
- multicast address to leave.IOException
- if an I/O exception occurs
while leaving the multicast group.protected abstract void leaveGroup(SocketAddress mcastaddr, NetworkInterface netIf) throws IOException
mcastaddr
- address to leave.netIf
- specified the local interface to leave the group atIOException
- if an I/O exception occurs while leaving
the multicast groupprotected abstract int peek(InetAddress i) throws IOException
InetAddress
to the address which the packet came from.
i
- an InetAddress objectIOException
- if an I/O exception occursprotected abstract int peekData(DatagramPacket p) throws IOException
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 occursprotected abstract void receive(DatagramPacket p) throws IOException
p
- the Packet Received.IOException
- if an I/O exception occurs
while receiving the datagram packet.protected abstract void send(DatagramPacket p) throws IOException
p
- the packet to be sent.IOException
- if an I/O exception occurs while sending the
datagram packet.protected abstract void setTimeToLive(int ttl) throws IOException
ttl
- an int specifying the time-to-live valueIOException
- if an I/O exception occurs
while setting the time-to-live option.protected abstract void setTTL(byte ttl) throws IOException
ttl
- a byte specifying the TTL valueIOException
- if an I/O exception occurs while setting
the time-to-live option.
| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |