Code example for DatagramPacket

Methods: getDatagetLength

0
DatagramPacket sendPacket, receivePacket;
 
        sendPacket =
            new DatagramPacket(__dummyData, __dummyData.length, host, port);
        receivePacket = new DatagramPacket(__timeData, __timeData.length);
 
        _socket_.send(sendPacket);
        _socket_.receive(receivePacket);
 
        return new String(receivePacket.getData(), 0, receivePacket.getLength());
    } 
 
    /*** Same as <code>getTime(host, DaytimeUDPClient.DEFAULT_PORT);</code> ***/ 
    public String getTime(InetAddress host) throws IOException
    { 
        return getTime(host, DEFAULT_PORT);
    } 
 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE