|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.net.DatagramSocketImpl
public abstract class DatagramSocketImpl
The abstract superclass of datagram & multicast socket implementations.
| Field Summary | |
|---|---|
protected FileDescriptor |
fd
|
protected int |
localPort
|
| Fields inherited from interface java.net.SocketOptions |
|---|
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 Summary | |
|---|---|
DatagramSocketImpl()
Constructs an unbound datagram socket implementation. |
|
| Method Summary | |
|---|---|
protected abstract void |
bind(int port,
InetAddress addr)
Bind the datagram socket to the nominated localhost/port. |
protected abstract void |
close()
Close the socket. |
protected void |
connect(InetAddress inetAddr,
int port)
Connect the socket to the specified remote address and port. |
protected abstract void |
create()
This method allocates the socket descriptor in the underlying operating system. |
protected void |
disconnect()
Disconnect the socket from the remote address and port. |
protected FileDescriptor |
getFileDescriptor()
Answer the FileDescriptor, which will be invalid if the socket is closed or not bound. |
(package private) InetAddress |
getLocalAddress()
Answer the local address to which the socket is bound. |
protected int |
getLocalPort()
Answer the local port. |
abstract Object |
getOption(int optID)
Answer the nominated socket option. |
protected abstract int |
getTimeToLive()
Answer the time-to-live (TTL) for multicast packets sent on this socket. |
protected abstract byte |
getTTL()
Deprecated. Replaced by getTimeToLive() |
protected abstract void |
join(InetAddress addr)
Add this socket to the multicast group. |
protected abstract void |
joinGroup(SocketAddress addr,
NetworkInterface netInterface)
Add this socket to the multicast group. |
protected abstract void |
leave(InetAddress addr)
Remove the socket from the multicast group. |
protected abstract void |
leaveGroup(SocketAddress addr,
NetworkInterface netInterface)
Remove the socket from the multicast group. |
protected abstract int |
peek(InetAddress sender)
Peek at the incoming packet to this socket and answer the sender's address into sender. |
protected abstract int |
peekData(DatagramPacket pack)
Receive data into the supplied datagram packet by peeking. |
protected abstract void |
receive(DatagramPacket pack)
Receive data into the supplied datagram packet. |
protected abstract void |
send(DatagramPacket pack)
Sends the supplied datagram packet. |
abstract void |
setOption(int optID,
Object val)
Set the nominated socket option. |
protected abstract void |
setTimeToLive(int ttl)
Set the time-to-live (TTL) for multicast packets sent on this socket. |
protected abstract void |
setTTL(byte ttl)
Deprecated. Replaced by setTimeToLive(int) |
| 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 port,
InetAddress addr)
throws SocketException
port - the port on the localhost to bindaddr - the address on the multihomed localhost to bind
SocketException - if an error occurred during bind, such as if the port was
already boundprotected abstract void close()
protected abstract void create()
throws SocketException
SocketExceptionprotected FileDescriptor getFileDescriptor()
InetAddress getLocalAddress()
protected int getLocalPort()
localPort value of -1, query the IP stack.
public abstract Object getOption(int optID)
throws SocketException
getOption in interface SocketOptionsoptID - the socket option to retrieve
SocketException - thrown if an error occurs while accessing the option
@Deprecated
protected abstract byte getTTL()
throws IOException
getTimeToLive()
IOException - The exception description.getTimeToLive()
protected abstract int getTimeToLive()
throws IOException
IOException - The exception description.
protected abstract void join(InetAddress addr)
throws IOException
addr - the multicast group to be joined
IOException - may be thrown while joining a group
protected abstract void joinGroup(SocketAddress addr,
NetworkInterface netInterface)
throws IOException
addr - the multicast group to be joinednetInterface - the network interface on which the addresses should be dropped
IOException - may be thrown while joining a group
protected abstract void leave(InetAddress addr)
throws IOException
addr - the multicast group to be left
IOException - May be thrown while leaving the group
protected abstract void leaveGroup(SocketAddress addr,
NetworkInterface netInterface)
throws IOException
addr - the multicast group to be leftnetInterface - the network interface on which the addresses should be dropped
IOException - May be thrown while leaving the group
protected abstract int peek(InetAddress sender)
throws IOException
sender. The method will block until a packet
is received or timeout expires and returns the sender's port.
IOException - if a read error or timeout occurs
protected abstract void receive(DatagramPacket pack)
throws IOException
IOException - if a read error or timeout occurs
protected abstract void send(DatagramPacket pack)
throws IOException
pack - DatagramPacket to send
IOException - if a write error occurs
public abstract void setOption(int optID,
Object val)
throws SocketException
setOption in interface SocketOptionsoptID - the socket option to setval - the option value
SocketException - thrown if an error occurs while setting the option
protected abstract void setTimeToLive(int ttl)
throws IOException
ttl - the time-to-live, 0 < ttl <= 255
IOException - The exception thrown while setting the TTL
@Deprecated
protected abstract void setTTL(byte ttl)
throws IOException
setTimeToLive(int)
ttl - the time-to-live, 0 < ttl <= 255
IOException - The exception thrown while setting the TTLsetTimeToLive(int)
protected void connect(InetAddress inetAddr,
int port)
throws SocketException
inetAddr - the remote addressport - the remote port
SocketException - possibly thrown, if the datagram socket cannot be
connected to the specified remote address and portprotected void disconnect()
protected abstract int peekData(DatagramPacket pack)
throws IOException
pack - the DatagramPacket used to store the data
IOException - if an error occurs
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||