    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. The fields of this class are package-private since DatagramSocketImpl classes needs to access them.

##

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

##

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

##

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.

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.

##

getAddress

      public InetAddress getAddress()

getPort

      public int getPort()

getData

      public byte[] getData()

getLength

      public int getLength()

    All Packages  Class Hierarchy  This Package  Previous  Next  Index