Code example for SocketTimeoutException

                // receiveDatagramImpl2 
                netImpl.receiveDatagram(fd, pack, pack.getData(), pack.getOffset(), pack
                        .getLength(), receiveTimeout, false);
        } catch (InterruptedIOException e) {
            throw new SocketTimeoutException(e.getMessage());
    public void send(DatagramPacket packet) throws IOException {
        if (isNativeConnected) {
            netImpl.sendConnectedDatagram(fd, packet.getData(), packet.getOffset(), packet
                    .getLength(), bindToDevice);
        } else { 
            // sendDatagramImpl2 
            netImpl.sendDatagram(fd, packet.getData(), packet.getOffset(), packet.getLength(),
                    packet.getPort(), bindToDevice, trafficClass, packet.getAddress());
Connect your IDE to all the code out there  Get Codota for Java