public void Send(Packet pkt) { // old code // byte[] buf = new byte[pkt.blob.length + 4]; // Utils.uint32e(pkt.type, buf, 0); // System.arraycopy(pkt.blob, 0, buf, 4, pkt.blob.length); byte[] buf = new byte[pkt.blob.length + 3]; buf[0] = (byte) ((pkt.blob.length + 2) & 0xff); buf[1] = (byte) ((pkt.blob.length + 2) >> 8 & 0xff); buf[2] = (byte) pkt.type; System.arraycopy(pkt.blob, 0, buf, 3, pkt.blob.length); if (Config.debug_packets) Log.debug("send pkt: " + Utils.getHexString(buf)); Send(buf); }