API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.net. DatagramPacket View Source
Author(s)
Pavani Diwanji
Benjamin Renaud
Since
JDK1.0
Version
1.46, 04/07/06
Serial
Hierarchy
 Object
      DatagramPacket
Implements
Subclasses
Description
publicfinal class DatagramPacket
  This class represents a datagram packet.
See also:   
Constructors
public DatagramPacket (byte[] buf, int length)
  Constructs a DatagramPacket for receiving packets of length length.
public DatagramPacket (byte[] buf, int length, InetAddress address, int port)
  Constructs a datagram packet for sending packets of length length to the specified port number on the specified host.
public DatagramPacket (byte[] buf, int offset, int length)
  Constructs a DatagramPacket for receiving packets of length length, specifying an offset into the buffer.
public DatagramPacket (byte[] buf, int offset, int length, InetAddress address, int port)
  Constructs a datagram packet for sending packets of length length with offset ioffsetto the specified port number on the specified host.
public DatagramPacket (byte[] buf, int offset, int length, SocketAddress address) throws SocketException
  Constructs a datagram packet for sending packets of length length with offset ioffsetto the specified port number on the specified host.
public DatagramPacket (byte[] buf, int length, SocketAddress address) throws SocketException
  Constructs a datagram packet for sending packets of length length to the specified port number on the specified host.
Methods
Hide/Show inherited methods
publicsynchronized InetAddress getAddress ()
  Returns the IP address of the machine to which this datagram is being sent or from which the datagram was received.
publicsynchronized byte getData ()
  Returns the data buffer.
publicsynchronized int getLength ()
  Returns the length of the data to be sent or the length of the data received.
publicsynchronized int getOffset ()
  Returns the offset of the data to be sent or the offset of the data received.
publicsynchronized int getPort ()
  Returns the port number on the remote host to which this datagram is being sent or from which the datagram was received.
publicsynchronized SocketAddress getSocketAddress ()
  Gets the SocketAddress (usually IP address + port number) of the remote host that this packet is being sent to or is coming from.
publicsynchronized void setAddress (InetAddress iaddr)
  Sets the IP address of the machine to which this datagram is being sent.
publicsynchronized void setData (byte[] buf)
  Set the data buffer for this packet.
publicsynchronized void setData (byte[] buf, int offset, int length)
  Set the data buffer for this packet.
publicsynchronized void setLength (int length)
  Set the length for this packet.
publicsynchronized void setPort (int iport)
  Sets the port number on the remote host to which this datagram is being sent.
publicsynchronized void setSocketAddress (SocketAddress address)
  Sets the SocketAddress (usually IP address + port number) of the remote host to which this datagram is being sent.
Fields
Hide/Show inherited fields
pack-private InetAddress address
pack-private byte buf
pack-private int bufLength
pack-private int length
pack-private int offset
pack-private int port
Nested Classes
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar