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

Quick Search    Search Deep

java.net
Class PlainDatagramSocketImpl  view PlainDatagramSocketImpl download PlainDatagramSocketImpl.java

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

class PlainDatagramSocketImpl
extends DatagramSocketImpl

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.


Field Summary
(package private) static int _Jv_IP_MULTICAST_IF_
           
(package private) static int _Jv_IP_MULTICAST_IF2_
           
(package private) static int _Jv_IP_MULTICAST_LOOP_
           
(package private) static int _Jv_IP_TOS_
           
(package private) static int _Jv_SO_BINDADDR_
           
(package private) static int _Jv_SO_BROADCAST_
           
(package private) static int _Jv_SO_KEEPALIVE_
           
(package private) static int _Jv_SO_LINGER_
           
(package private) static int _Jv_SO_OOBINLINE_
           
(package private) static int _Jv_SO_RCVBUF_
           
(package private) static int _Jv_SO_REUSEADDR_
           
(package private) static int _Jv_SO_SNDBUF_
           
(package private) static int _Jv_SO_TIMEOUT_
           
(package private) static int _Jv_TCP_NODELAY_
           
(package private)  int fnum
           
(package private)  InetAddress localAddress
           
(package private)  int timeout
           
 
Fields inherited from class java.net.DatagramSocketImpl
fd, 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
PlainDatagramSocketImpl()
           
 
Method Summary
protected  void bind(int lport, InetAddress laddr)
          This method binds the socket to the specified local port and address.
protected  void close()
          This methods closes the socket
protected  void connect(InetAddress i, int port)
          Connects the socket to a host specified by address and port.
protected  void create()
          Creates a new datagram socket.
protected  void disconnect()
          Disconnects the socket.
protected  void finalize()
          Called on an object by the Virtual Machine at most once, at some point after the Object is determined unreachable but before it is destroyed.
 java.lang.Object getOption(int optID)
          Returns the current setting of the specified option.
protected  int getTimeToLive()
          This method returns the current Time to Live (TTL) setting on this socket.
protected  byte getTTL()
          This method returns the current Time to Live (TTL) setting on this socket.
protected  void join(InetAddress inetaddr)
          Causes this socket to join the specified multicast group
protected  void joinGroup(SocketAddress mcastaddr, NetworkInterface netIf)
          Causes this socket to join the specified multicast group on a specified device
protected  void leave(InetAddress inetaddr)
          Causes the socket to leave the specified multicast group.
protected  void leaveGroup(SocketAddress mcastaddr, NetworkInterface netIf)
          Leaves a multicast group
private  void mcastGrp(InetAddress inetaddr, NetworkInterface netIf, boolean join)
           
protected  int peek(InetAddress i)
          Takes a peek at the next packet received in order to retrieve the address of the sender
protected  int peekData(DatagramPacket dp)
          Takes a peek at the next packet received.
protected  void receive(DatagramPacket p)
          Receives a packet of data from the network Will block until a packet arrives.
protected  void send(DatagramPacket p)
          Transmits the specified packet of data to the network.
 void setOption(int optID, java.lang.Object value)
          Sets the specified option on a socket to the passed in object.
protected  void setTimeToLive(int ttl)
          Sets the Time to Live (TTL) setting on this socket to the specified value.
protected  void setTTL(byte ttl)
          Sets the Time to Live (TTL) setting on this socket to the specified value.
 
Methods inherited from class java.net.DatagramSocketImpl
getFileDescriptor, getLocalPort
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_Jv_TCP_NODELAY_

static final int _Jv_TCP_NODELAY_
See Also:
Constant Field Values

_Jv_SO_BINDADDR_

static final int _Jv_SO_BINDADDR_
See Also:
Constant Field Values

_Jv_SO_REUSEADDR_

static final int _Jv_SO_REUSEADDR_
See Also:
Constant Field Values

_Jv_SO_BROADCAST_

static final int _Jv_SO_BROADCAST_
See Also:
Constant Field Values

_Jv_SO_OOBINLINE_

static final int _Jv_SO_OOBINLINE_
See Also:
Constant Field Values

_Jv_IP_MULTICAST_IF_

static final int _Jv_IP_MULTICAST_IF_
See Also:
Constant Field Values

_Jv_IP_MULTICAST_IF2_

static final int _Jv_IP_MULTICAST_IF2_
See Also:
Constant Field Values

_Jv_IP_MULTICAST_LOOP_

static final int _Jv_IP_MULTICAST_LOOP_
See Also:
Constant Field Values

_Jv_IP_TOS_

static final int _Jv_IP_TOS_
See Also:
Constant Field Values

_Jv_SO_LINGER_

static final int _Jv_SO_LINGER_
See Also:
Constant Field Values

_Jv_SO_TIMEOUT_

static final int _Jv_SO_TIMEOUT_
See Also:
Constant Field Values

_Jv_SO_SNDBUF_

static final int _Jv_SO_SNDBUF_
See Also:
Constant Field Values

_Jv_SO_RCVBUF_

static final int _Jv_SO_RCVBUF_
See Also:
Constant Field Values

_Jv_SO_KEEPALIVE_

static final int _Jv_SO_KEEPALIVE_
See Also:
Constant Field Values

fnum

int fnum

localAddress

InetAddress localAddress

timeout

int timeout
Constructor Detail

PlainDatagramSocketImpl

public PlainDatagramSocketImpl()
Method Detail

bind

protected void bind(int lport,
                    InetAddress laddr)
             throws SocketException
Description copied from class: DatagramSocketImpl
This method binds the socket to the specified local port and address.

Specified by:
bind in class DatagramSocketImpl

connect

protected void connect(InetAddress i,
                       int port)
                throws SocketException
Description copied from class: DatagramSocketImpl
Connects the socket to a host specified by address and port.

Overrides:
connect in class DatagramSocketImpl

disconnect

protected void disconnect()
Description copied from class: DatagramSocketImpl
Disconnects the socket.

Overrides:
disconnect in class DatagramSocketImpl

create

protected void create()
               throws SocketException
Description copied from class: DatagramSocketImpl
Creates a new datagram socket.

Specified by:
create in class DatagramSocketImpl

peek

protected int peek(InetAddress i)
            throws java.io.IOException
Description copied from class: DatagramSocketImpl
Takes a peek at the next packet received in order to retrieve the address of the sender

Specified by:
peek in class DatagramSocketImpl

peekData

protected int peekData(DatagramPacket dp)
                throws java.io.IOException
Description copied from class: DatagramSocketImpl
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.

Specified by:
peekData in class DatagramSocketImpl

setTimeToLive

protected void setTimeToLive(int ttl)
                      throws java.io.IOException
Description copied from class: DatagramSocketImpl
Sets the Time to Live (TTL) setting on this socket to the specified value.

Specified by:
setTimeToLive in class DatagramSocketImpl

getTimeToLive

protected int getTimeToLive()
                     throws java.io.IOException
Description copied from class: DatagramSocketImpl
This method returns the current Time to Live (TTL) setting on this socket.

Specified by:
getTimeToLive in class DatagramSocketImpl

send

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

Specified by:
send in class DatagramSocketImpl

receive

protected void receive(DatagramPacket p)
                throws java.io.IOException
Description copied from class: DatagramSocketImpl
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.

Specified by:
receive in class DatagramSocketImpl

setOption

public void setOption(int optID,
                      java.lang.Object value)
               throws SocketException
Description copied from interface: SocketOptions
Sets the specified option on a socket to the passed in object. For options that take an integer argument, the passed in object is an Integer. For options that are set to on or off, the value passed will be a Boolean. The optionId parameter is one of the defined constants in this interface.


getOption

public java.lang.Object getOption(int optID)
                           throws SocketException
Description copied from interface: SocketOptions
Returns the current setting of the specified option. The Object returned will be an Integer for options that have integer values. For options that are set to on or off, a Boolean will be returned. The optionId parameter is one of the defined constants in this interface.


mcastGrp

private void mcastGrp(InetAddress inetaddr,
                      NetworkInterface netIf,
                      boolean join)
               throws java.io.IOException

close

protected void close()
Description copied from class: DatagramSocketImpl
This methods closes the socket

Specified by:
close in class DatagramSocketImpl

getTTL

protected byte getTTL()
               throws java.io.IOException
Description copied from class: DatagramSocketImpl
This method returns the current Time to Live (TTL) setting on this socket. Use getTimeToLive() instead.

Specified by:
getTTL in class DatagramSocketImpl

setTTL

protected void setTTL(byte ttl)
               throws java.io.IOException
Description copied from class: DatagramSocketImpl
Sets the Time to Live (TTL) setting on this socket to the specified value. Use setTimeToLive(int) instead.

Specified by:
setTTL in class DatagramSocketImpl

join

protected void join(InetAddress inetaddr)
             throws java.io.IOException
Description copied from class: DatagramSocketImpl
Causes this socket to join the specified multicast group

Specified by:
join in class DatagramSocketImpl

leave

protected void leave(InetAddress inetaddr)
              throws java.io.IOException
Description copied from class: DatagramSocketImpl
Causes the socket to leave the specified multicast group.

Specified by:
leave in class DatagramSocketImpl

joinGroup

protected void joinGroup(SocketAddress mcastaddr,
                         NetworkInterface netIf)
                  throws java.io.IOException
Description copied from class: DatagramSocketImpl
Causes this socket to join the specified multicast group on a specified device

Specified by:
joinGroup in class DatagramSocketImpl

leaveGroup

protected void leaveGroup(SocketAddress mcastaddr,
                          NetworkInterface netIf)
                   throws java.io.IOException
Description copied from class: DatagramSocketImpl
Leaves a multicast group

Specified by:
leaveGroup in class DatagramSocketImpl

finalize

protected void finalize()
                 throws java.lang.Throwable
Description copied from class: java.lang.Object
Called on an object by the Virtual Machine at most once, at some point after the Object is determined unreachable but before it is destroyed. You would think that this means it eventually is called on every Object, but this is not necessarily the case. If execution terminates abnormally, garbage collection does not always happen. Thus you cannot rely on this method to always work. For finer control over garbage collection, use references from the java.lang.ref package.

Virtual Machines are free to not call this method if they can determine that it does nothing important; for example, if your class extends Object and overrides finalize to do simply super.finalize().

finalize() will be called by a java.lang.Thread that has no locks on any Objects, and may be called concurrently. There are no guarantees on the order in which multiple objects are finalized. This means that finalize() is usually unsuited for performing actions that must be thread-safe, and that your implementation must be use defensive programming if it is to always work.

If an Exception is thrown from finalize() during garbage collection, it will be patently ignored and the Object will still be destroyed.

It is allowed, although not typical, for user code to call finalize() directly. User invocation does not affect whether automatic invocation will occur. It is also permitted, although not recommended, for a finalize() method to "revive" an object by making it reachable from normal code again.

Unlike constructors, finalize() does not get called for an object's superclass unless the implementation specifically calls super.finalize().

The default implementation does nothing.