java.net.DatagramSocketImpl
java.lang.Object
None
None
New as of JDK 1.1
The DatagramSocketImpl class is an abstract class that defines the bulk of the methods that make the DatagramSocket and MulticastSocket classes work. Non-public subclasses of DatagramSocketImpl provide platform-specific implementations of datagram socket communication.
public abstract class java.net.DatagramSocketImpl extends java.lang.Object { // Variables protected FileDescriptor fd; protected int localPort; // Protected Instance Methods protected abstract void bind(int lport, InetAddress laddr); protected abstract void close(); protected abstract void create(); protected FileDescriptor getFileDescriptor(); protected int getLocalPort(); protected abstract byte getTTL(); protected abstract void join(InetAddress inetaddr); protected abstract void leave(InetAddress inetaddr); protected abstract int peek(InetAddress i); protected abstract void receive(DatagramPacket p); protected abstract void send(DatagramPacket p); protected abstract void setTTL(byte ttl); }
The file descriptor that represents this socket.
The local port number of this socket.
protected abstract void bind(int lport, InetAddress laddr) throws SocketException
A port number.
A local address.
If any kind of socket error occurs.
This method binds the socket to the given address and port. If the address or the port is unavailable, an exception is thrown.
This method closes the socket, releasing any system resources it holds.
If a socket error occurs.
This method creates a socket that is not bound to an address and port.
The file descriptor for this socket.
This method returns the file descriptor associated with this DatagramSocketImpl.
The port number for this socket.
This method returns the local port to which this DatagramSocketImpl is bound.
The time-to-live (TTL) value for this socket.
If any kind of I/O error occurs.
This method returns the TTL value for this socket. This value is the number of hops that an outgoing packet can traverse before it is discarded.
protected abstract void join(InetAddress inetaddr) throws IOException
The IP address of the group to join.
If any kind of I/O error occurs.
This method is used by MulticastSocket to join a multicast group. An exception is thrown if the given address is not a multicast address. While the socket is part of a group, it receives all packets that are sent to the group.
protected abstract void leave(InetAddress inetaddr) throws IOException
The IP address of the group to leave.
If any kind of I/O error occurs.
This method is used by MulticastSocket to leave a multicast group. An exception is thrown if the given address is not a multicast address.
A reference to an InetAddress object.
The port number of the next incoming packet.
If any kind of I/O error occurs.
This method places the address of the next incoming packet in the given InetAddress object. The method also returns the port number of the next incoming packet. The method looks at the address of an incoming packet to determine if it should be accepted.
protected abstract void receive(DatagramPacket p) throws IOException
The DatagramPacket that receives incoming data.
If any kind of I/O error occurs.
This method receives a datagram packet on this socket. After this method returns, the given DatagramPacket contains the packet's data and length, and the sender's address and port number. If the data that was sent is longer that the given packet's data buffer, the data is truncated.
The DatagramPacket to be sent.
If any kind of I/O error occurs.
This method sends a packet from this socket. The packet data, packet length, destination address, and destination port number are specified by the given DatagramPacket.
The new TTL value for this socket.
If any kind of I/O error occurs.
This method is used to set the TTL value of the socket. The TTL value is the number of hops that an outgoing packet can traverse before it is discarded.
Method |
Inherited From |
Method |
Inherited From |
---|---|---|---|
clone() |
Object |
equals(Object) |
Object |
finalize() |
Object |
getClass() |
Object |
hashCode() |
Object |
notify() |
Object |
notifyAll() |
Object |
toString() |
Object |
wait() |
Object |
wait(long) |
Object |
wait(long, int) |
Object |
DatagramPacket, DatagramSocket, FileDescriptor, InetAddress, IOException, MulticastSocket