DatagramSocketImpl

public abstract class DatagramSocketImpl extends Object
implements SocketOptions

The abstract superclass for datagram and multicast socket implementations.

Inherited Constant Summary

Field Summary

protected FileDescriptor fd File descriptor that is used to address this socket.
protected int localPort The number of the local port to which this socket is bound.

Public Constructor Summary

DatagramSocketImpl()
Constructs an unbound datagram socket implementation.

Protected Method Summary

abstract void
bind(int port, InetAddress addr)
Binds the datagram socket to the given localhost/port.
abstract void
close()
Closes this socket.
void
connect(InetAddress inetAddr, int port)
Connects this socket to the specified remote address and port.
abstract void
create()
This method allocates the socket descriptor in the underlying operating system.
void
disconnect()
Disconnects this socket from the remote host.
FileDescriptor
getFileDescriptor()
Gets the FileDescriptor of this datagram socket, which is invalid if the socket is closed or not bound.
int
getLocalPort()
Returns the local port to which this socket is bound.
abstract byte
getTTL()
This method was deprecated. Use getTimeToLive() instead.
abstract int
getTimeToLive()
Gets the time-to-live (TTL) for multicast packets sent on this socket.
abstract void
join(InetAddress addr)
Adds this socket to the multicast group addr.
abstract void
joinGroup(SocketAddress addr, NetworkInterface netInterface)
Adds this socket to the multicast group addr.
abstract void
leave(InetAddress addr)
Removes this socket from the multicast group addr.
abstract void
leaveGroup(SocketAddress addr, NetworkInterface netInterface)
Removes this socket from the multicast group addr.
abstract int
peek(InetAddress sender)
Peeks at the incoming packet to this socket and returns the address of the sender.
abstract int
peekData(DatagramPacket pack)
Receives data into the supplied datagram packet by peeking.
abstract void
receive(DatagramPacket pack)
Receives data and stores it in the supplied datagram packet pack.
abstract void
send(DatagramPacket pack)
Sends the given datagram packet pack.
abstract void
setTTL(byte ttl)
This method was deprecated. Use setTimeToLive(int) instead.
abstract void
setTimeToLive(int ttl)
Sets the time-to-live (TTL) option for multicast packets sent on this socket.

Inherited Method Summary