Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java.net
Class DatagramSocketImpl  view DatagramSocketImpl download DatagramSocketImpl.java

java.lang.Object
  extended byjava.net.DatagramSocketImpl
All Implemented Interfaces:
SocketOptions
Direct Known Subclasses:
PlainDatagramSocketImpl

public abstract class DatagramSocketImpl
extends java.lang.Object
implements SocketOptions

This abstract class models a datagram socket implementation. An actual implementation class would implement these methods, probably via redirecting them to native code.

Written using on-line Java Platform 1.2 API Specification, as well as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).

Status: Believed complete and correct.

Since:
1.1

Field Summary
protected  java.io.FileDescriptor fd
          The FileDescriptor object for this object.
protected  int localPort
          The local port to which this socket is bound
 
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()
          Default, no-argument constructor for subclasses to call.
 
Method Summary
protected abstract  void bind(int lport, InetAddress laddr)
          This method binds the socket to the specified local port and address.
protected abstract  void close()
          This methods closes the socket
protected  void connect(InetAddress address, int port)
          Connects the socket to a host specified by address and port.
protected abstract  void create()
          Creates a new datagram socket.
protected  void disconnect()
          Disconnects the socket.
protected  java.io.FileDescriptor getFileDescriptor()
          Returns the FileDescriptor for this socket
protected  int getLocalPort()
          Returns the local port this socket is bound to
protected abstract  int getTimeToLive()
          This method returns the current Time to Live (TTL) setting on this socket.
protected abstract  byte getTTL()
          Deprecated. // FIXME: when ?
protected abstract  void join(InetAddress inetaddr)
          Causes this socket to join the specified multicast group
protected abstract  void joinGroup(SocketAddress mcastaddr, NetworkInterface netIf)
          Causes this socket to join the specified multicast group on a specified device
protected abstract  void leave(InetAddress inetaddr)
          Causes the socket to leave the specified multicast group.
protected abstract  void leaveGroup(SocketAddress mcastaddr, NetworkInterface netIf)
          Leaves a multicast group
protected abstract  int peek(InetAddress i)
          Takes a peek at the next packet received in order to retrieve the address of the sender
protected abstract  int peekData(DatagramPacket p)
          Takes a peek at the next packet received.
protected abstract  void receive(DatagramPacket p)
          Receives a packet of data from the network Will block until a packet arrives.
protected abstract  void send(DatagramPacket p)
          Transmits the specified packet of data to the network.
protected abstract  void setTimeToLive(int ttl)
          Sets the Time to Live (TTL) setting on this socket to the specified value.
protected abstract  void setTTL(byte ttl)
          Deprecated.  
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.net.SocketOptions
getOption, setOption
 

Field Detail

localPort

protected int localPort
The local port to which this socket is bound


fd

protected java.io.FileDescriptor fd
The FileDescriptor object for this object.

Constructor Detail

DatagramSocketImpl

public DatagramSocketImpl()
Default, no-argument constructor for subclasses to call.

Method Detail

bind

protected abstract void bind(int lport,
                             InetAddress laddr)
                      throws SocketException
This method binds the socket to the specified local port and address.


close

protected abstract void close()
This methods closes the socket


create

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


peek

protected abstract int peek(InetAddress i)
                     throws java.io.IOException
Takes a peek at the next packet received in order to retrieve the address of the sender


peekData

protected abstract int peekData(DatagramPacket p)
                         throws java.io.IOException
Takes a peek at the next packet received. This packet is not consumed. With the next peekData/receive operation this packet will be read again.

Since:
1.4

send

protected abstract void send(DatagramPacket p)
                      throws java.io.IOException
Transmits the specified packet of data to the network. The destination host and port should be encoded in the packet.


receive

protected abstract void receive(DatagramPacket p)
                         throws java.io.IOException
Receives a packet of data from the network Will block until a packet arrives. The packet info in populated into the passed in DatagramPacket object.


connect

protected void connect(InetAddress address,
                       int port)
                throws SocketException
Connects the socket to a host specified by address and port.

Since:
1.4

disconnect

protected void disconnect()
Disconnects the socket.

Since:
1.4

setTTL

protected abstract void setTTL(byte ttl)
                        throws java.io.IOException
Deprecated.  

Sets the Time to Live (TTL) setting on this socket to the specified value. Use setTimeToLive(int) instead.


getTTL

protected abstract byte getTTL()
                        throws java.io.IOException
Deprecated. // FIXME: when ?

This method returns the current Time to Live (TTL) setting on this socket. Use getTimeToLive() instead.


setTimeToLive

protected abstract void setTimeToLive(int ttl)
                               throws java.io.IOException
Sets the Time to Live (TTL) setting on this socket to the specified value.


getTimeToLive

protected abstract int getTimeToLive()
                              throws java.io.IOException
This method returns the current Time to Live (TTL) setting on this socket.


join

protected abstract void join(InetAddress inetaddr)
                      throws java.io.IOException
Causes this socket to join the specified multicast group


leave

protected abstract void leave(InetAddress inetaddr)
                       throws java.io.IOException
Causes the socket to leave the specified multicast group.


joinGroup

protected abstract void joinGroup(SocketAddress mcastaddr,
                                  NetworkInterface netIf)
                           throws java.io.IOException
Causes this socket to join the specified multicast group on a specified device

Since:
1.4

leaveGroup

protected abstract void leaveGroup(SocketAddress mcastaddr,
                                   NetworkInterface netIf)
                            throws java.io.IOException
Leaves a multicast group

Since:
1.4

getFileDescriptor

protected java.io.FileDescriptor getFileDescriptor()
Returns the FileDescriptor for this socket


getLocalPort

protected int getLocalPort()
Returns the local port this socket is bound to