Class java.net.DatagramPacket
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.net.DatagramPacket

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

public final class DatagramPacket
extends Object
A class that represents a datagram packet containing packet data, packet length, internet addresses and port.

Constructor Index

 o DatagramPacket(byte[], int)
This constructor is used to create a DatagramPacket object used for receiving datagrams.
 o DatagramPacket(byte[], int, InetAddress, int)
This constructor is used construct the DatagramPacket to be sent.

Method Index

 o getAddress()
 o getData()
 o getLength()
 o getPort()

Constructors

 o DatagramPacket
  public DatagramPacket(byte ibuf[],
                        int ilength)
This constructor is used to create a DatagramPacket object used for receiving datagrams.
Parameters:
ibuf - is where packet data is to be received.
ilength - is the number of bytes to be received.
 o DatagramPacket
  public DatagramPacket(byte ibuf[],
                        int ilength,
                        InetAddress iaddr,
                        int iport)
This constructor is used construct the DatagramPacket to be sent.
Parameters:
ibuf - contains the packet data.
ilength - contains the packet length
iaddr - and iport contains destination ip addr and port number.

Methods

 o getAddress
  public InetAddress getAddress()
 o getPort
  public int getPort()
 o getData
  public byte[] getData()
 o getLength
  public int getLength()

All Packages  Class Hierarchy  This Package  Previous  Next  Index