public static byte[] sendMessage(String message, int type, int Tabid){
        PDU rawdata = null;
        try {
            byte[] msgByte = message.getBytes("UTF-8");
            switch(type){
                case 1:
                    msgByte = compress(msgByte);
                    break;
                case 2:
                    msgByte = enCrypt(msgByte,Tabid);
                    break;
                case 3:
                    msgByte = enCrypt(compress(msgByte),Tabid);
                    break;
            }
            rawdata = new PDU(12 + div4(msgByte.length));
            //  Adds the header
            rawdata.setByte(0, (byte) OpCodes.MESSAGE);
            rawdata.setByte(1, (byte)type);
            rawdata.setShort(4, (short)msgByte.length);
            rawdata.setSubrange(12, msgByte);
            //  Calculate the checkSum
            System.out.println("totLength: '" + rawdata.length() + "', Message length: '" + msgByte.length + "'");
            rawdata.setByte(3, Checksum.calc(rawdata.getBytes(), 12 + Message.div4(msgByte.length)));
        }catch(UnsupportedEncodingException e){
            System.out.println("Unsupported Encoding Exception: " + e);
        }
        return rawdata.getBytes();
    }