Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| J2ME Foundation
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## java.net
Class DatagramSocketImpl

    java.lang.Object
      |
      +--java.net.DatagramSocketImpl

All Implemented Interfaces:
  SocketOptions

public abstract class DatagramSocketImpl
extends Object
implements SocketOptions

Abstract datagram and multicast socket implementation base class.

Since:
  JDK1.1

Field Summary
`protected FileDescriptor` | `fd` The file descriptor object.
`protected int` | `localPort` The local port number.

Fields inherited from interface java.net.SocketOptions
`IP_MULTICAST_IF, SO_BINDADDR, SO_KEEPALIVE, SO_LINGER, SO_RCVBUF, SO_REUSEADDR, SO_SNDBUF, SO_TIMEOUT, TCP_NODELAY`

Constructor Summary
`DatagramSocketImpl()`

Method Summary
`protected abstract void` | `bind(int lport, InetAddress laddr)` Binds a datagram socket to a local port and address.
`protected abstract void` | `close()` Close the socket.
`protected abstract void` | `create()` Creates a datagram socket.
`protected FileDescriptor` | `getFileDescriptor()` Gets the datagram socket file descriptor.
`protected int` | `getLocalPort()` Gets the local port.
`protected abstract int` | `getTimeToLive()` Retrieve the TTL (time-to-live) option.
`protected abstract void` | `join(InetAddress inetaddr)` Join the multicast group.
`protected abstract void` | `leave(InetAddress inetaddr)` Leave the multicast group.
`protected abstract int` | `peek(InetAddress i)` Peek at the packet to see who it is from.
`protected abstract void` | `receive(DatagramPacket p)` Receive the datagram packet.
`protected abstract void` | `send(DatagramPacket p)` Sends a datagram packet.
`protected abstract void` | `setTimeToLive(int 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`

Methods inherited from interface java.net.SocketOptions
`getOption, setOption`

Field Detail

### localPort

    protected int localPort

  The local port number.

### fd

    protected FileDescriptor fd

  The file descriptor object.

Constructor Detail

### DatagramSocketImpl

    public DatagramSocketImpl()

Method Detail

### 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.

### 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.

### 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.

### peek

    protected abstract int peek(InetAddress i)
                         throws IOException

  Peek at the packet to see who it is from.
  Parameters:
    `i` - an InetAddress object
  Returns:
    the address 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.

### 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.
  See Also:
    `getTimeToLive()`

### 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
  See Also:
    `setTimeToLive(int)`

### 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.

### 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.

### close

    protected abstract void close()

  Close the socket.

### getLocalPort

    protected int getLocalPort()

  Gets the local port.
  Returns:
    an `int` representing the local port value

### getFileDescriptor

    protected FileDescriptor getFileDescriptor()

  Gets the datagram socket file descriptor.
  Returns:
    a `FileDescriptor` object representing the datagram socket file descriptor

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| J2ME Foundation
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Java is a trademark or registred trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road,
Palo, Alto, California, 94303, U.S.A All Rights Reserved. < /font >