站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JDK 5 Documentation v1.2.2, Java 2 SDK 英文文档

Java(TM) 2 Platform, Standard Edition, v1.2.2 API Specification: Class DatagramSocketImpl - JDK 5 Documentation v1.2.2, Java 2 SDK 英文文档

JavaTM 2 Platform
Standard Edition

java.net
Class DatagramSocketImpl

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

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
           
 
Fields inherited from interface java.net.SocketOptions
IP_MULTICAST_IF, SO_BINDADDR, 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()
          Get the datagram socket file descriptor
protected  int getLocalPort()
          Get the local port.
protected abstract  int getTimeToLive()
          Retrieve the TTL (time-to-live) option.
protected abstract  byte getTTL()
          Deprecated. use getTimeToLive instead.
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.
protected abstract  void setTTL(byte ttl)
          Deprecated. use setTimeToLive instead.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

localPort

protected int localPort

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

bind

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

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:
packet - to be sent.

peek

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

receive

protected abstract void receive(DatagramPacket p)
                         throws IOException
Receive the datagram packet.
Parameters:
Packet - Received.

setTTL

protected abstract void setTTL(byte ttl)
                        throws IOException
Deprecated. use setTimeToLive instead.

Set the TTL (time-to-live) option.
Parameters:
TTL - to be set.

getTTL

protected abstract byte getTTL()
                        throws IOException
Deprecated. use getTimeToLive instead.

Retrieve the TTL (time-to-live) option.

setTimeToLive

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

getTimeToLive

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

join

protected abstract void join(InetAddress inetaddr)
                      throws IOException
Join the multicast group.
Parameters:
multicast - address to join.

leave

protected abstract void leave(InetAddress inetaddr)
                       throws IOException
Leave the multicast group.
Parameters:
multicast - address to leave.

close

protected abstract void close()
Close the socket.

getLocalPort

protected int getLocalPort()
Get the local port.

getFileDescriptor

protected FileDescriptor getFileDescriptor()
Get the datagram socket file descriptor

JavaTM 2 Platform
Standard Edition

Submit a bug or feature
Java, Java 2D, and JDBC are a trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1999 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.