This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


java.net
class DatagramSocketImpl

java.lang.Object extended by java.net.DatagramSocketImpl
All Implemented Interfaces:
SocketOptions

public abstract class DatagramSocketImpl
extends Object
implements SocketOptions

Abstract datagram and multicast socket implementation base class.

See Also (auto-generated):

DatagramSocket

InetAddress

MulticastSocket


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 the socket.
protected void
connect(InetAddress address, int port)

          Connects a datagram socket to a remote destination.
protected abstract void

          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

          Retrieve the TTL (time-to-live) option.
protected abstract void
join(InetAddress inetaddr)

          Join the multicast group.
protected abstract void

          Join the multicast group.
protected abstract void
leave(InetAddress inetaddr)

          Leave the multicast group.
protected abstract void

          Leave the multicast group.
protected abstract int

          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

fd

protected FileDescriptor fd
The file descriptor object.

localPort

protected int localPort
The local port number.
Constructor Detail

DatagramSocketImpl

public DatagramSocketImpl()
Method Detail

bind

protected abstract void bind(int lport,
                             InetAddress laddr)
                      throws SocketException
Binds a datagram socket to a local port and address.

Parameters:
lport - the local port
laddr - the local address
Throws:
SocketException - if there is an error in the underlying protocol, such as a TCP error.

close

protected abstract void close()
Close the socket.


connect

protected void connect(InetAddress address,
                       int port)
                throws SocketException
Connects a datagram socket to a remote destination. This associates the remote address with the local socket so that datagrams may only be sent to this destination and received from this destination. This may be overridden to call a native system connect.

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.

Parameters:
address - the remote InetAddress to connect to
port - the remote port number
Throws:
SocketException - may be thrown if the socket cannot be connected to the remote destination

create

protected abstract void create()
                        throws SocketException
Creates a datagram socket.

Throws:
SocketException - if there is an error in the underlying protocol, such as a TCP error.

disconnect

protected void disconnect()
Disconnects a datagram socket from its remote destination.


getFileDescriptor

protected FileDescriptor getFileDescriptor()
Gets the datagram socket file descriptor.

Returns:
a FileDescriptor object representing the datagram socket file descriptor

getLocalPort

protected int getLocalPort()
Gets the local port.

Returns:
an int representing the local port value

getTimeToLive

protected abstract int getTimeToLive()
                              throws IOException
Retrieve the TTL (time-to-live) option.

Returns:
an int representing the time-to-live value
Throws:
IOException - if an I/O exception occurs while retrieving the time-to-live option

getTTL

protected abstract byte getTTL()
                        throws IOException
Retrieve the TTL (time-to-live) option.

Returns:
a byte representing the TTL value
Throws:
IOException - if an I/O exception occurs while retrieving the time-to-live option

join

protected abstract void join(InetAddress inetaddr)
                      throws IOException
Join the multicast group.

Parameters:
inetaddr - multicast address to join.
Throws:
IOException - if an I/O exception occurs while joining the multicast group.

joinGroup

protected abstract void joinGroup(SocketAddress mcastaddr,
                                  NetworkInterface netIf)
                           throws IOException
Join the multicast group.

Parameters:
mcastaddr - address to join.
netIf - specifies the local interface to receive multicast datagram packets
Throws:
IOException - if an I/O exception occurs while joining the multicast group

leave

protected abstract void leave(InetAddress inetaddr)
                       throws IOException
Leave the multicast group.

Parameters:
inetaddr - multicast address to leave.
Throws:
IOException - if an I/O exception occurs while leaving the multicast group.

leaveGroup

protected abstract void leaveGroup(SocketAddress mcastaddr,
                                   NetworkInterface netIf)
                            throws IOException
Leave the multicast group.

Parameters:
mcastaddr - address to leave.
netIf - specified the local interface to leave the group at
Throws:
IOException - if an I/O exception occurs while leaving the multicast group

peek

protected abstract int peek(InetAddress i)
                     throws IOException
Peek at the packet to see who it is from. Updates the specified InetAddress to the address which the packet came from.

Parameters:
i - an InetAddress object
Returns:
the port number which the packet came from.
Throws:
IOException - if an I/O exception occurs

peekData

protected abstract int peekData(DatagramPacket p)
                         throws IOException
Peek at the packet to see who it is from. The data is copied into the specified DatagramPacket. The data is returned, but not consumed, so that a subsequent peekData/receive operation will see the same data.

Parameters:
p - the Packet Received.
Returns:
the port number which the packet came from.
Throws:
IOException - if an I/O exception occurs

receive

protected abstract void receive(DatagramPacket p)
                         throws IOException
Receive the datagram packet.

Parameters:
p - the Packet Received.
Throws:
IOException - if an I/O exception occurs while receiving the datagram packet.

send

protected abstract void send(DatagramPacket p)
                      throws IOException
Sends a datagram packet. The packet contains the data and the destination address to send the packet to.

Parameters:
p - the packet to be sent.
Throws:
IOException - if an I/O exception occurs while sending the datagram packet.

setTimeToLive

protected abstract void setTimeToLive(int ttl)
                               throws IOException
Set the TTL (time-to-live) option.

Parameters:
ttl - an int specifying the time-to-live value
Throws:
IOException - if an I/O exception occurs while setting the time-to-live option.

setTTL

protected abstract void setTTL(byte ttl)
                        throws IOException
Set the TTL (time-to-live) option.

Parameters:
ttl - a byte specifying the TTL value
Throws:
IOException - if an I/O exception occurs while setting the time-to-live option.


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.