Code example for DatagramPacket

Methods: getLengthsetDatasetLength

     * @return  Length of actual data received. 
     * @exception IOException If an error occurs while receiving the data. 
    public int receive(byte[] data, int length) throws IOException
        return __receivePacket.getLength();
    /*** Same as <code> receive(data, data.length)</code> ***/ 
    public int receive(byte[] data) throws IOException
        return receive(data, data.length);
Contextual code suggestions in your IDE  Get Codota for Java