Ejemplo n.º 1
0
    //解码器
    public override ProtocolBase Decode(byte[] readbuff, int start, int length)
    {
        ProtocolStr protocol = new ProtocolStr();

        protocol.str = System.Text.Encoding.UTF8.GetString(readbuff, start, length);
        return((ProtocolBase)protocol);
    }
Ejemplo n.º 2
0
    public override ProtocolBase Decode(byte[] bufferRead, int start, int length)
    {
        ProtocolStr proto = new ProtocolStr();

        byte[] tempBuffer = new byte[length - sizeof(Int32)];
        Array.Copy(bufferRead, sizeof(Int32), tempBuffer, 0, tempBuffer.Length);
        proto.Data = Encoding.UTF8.GetString(tempBuffer);
        //刷新协议
        InitInfomation();
        return(proto);
    }