Code example for DatagramPacket

Methods: getAddress, getData, getLength, getOffset, getPort

0
   * @throws IOException If an error occurs 
   */ 
  static void send(PlainDatagramSocketImpl socket, DatagramPacket packet)
    throws IOException 
  { 
    nativeSendTo(socket, packet.getAddress(), packet.getPort(),
                 packet.getData(), packet.getOffset(), packet.getLength());
  } 
 
 
  /** 
   * Sends a packet of data to a remote host. 
   * 
   * @param socket the socket object 
   * @param addr the address to send to 
   * @param port the port to send to 
   * @param buf the buffer to send 
   * @param offset the offset of the data in the buffer to send 
   * @param len the length of the data to send 
   * 
   * @throws IOException If an error occurs