private ByteBuffer writePacket(DatagramChannel peer2, String msg) throws IOException
    {
        ByteBuffer b = ByteBuffer.allocate(1000);
        HELPER.putString(b, msg);
        HELPER.doneFillingBuffer(b);        
        peer2.write(b);
        return b;
    }