예제 #1
0
 private void EncodeHeader(RemotingHeader header, byte[] buffer, Stream stream)
 {
     ByteBufHelper.WriteInt32(RemotingHeader.QmqMagicCode, buffer, stream);
     ByteBufHelper.WriteInt16(header.Code, buffer, stream);
     ByteBufHelper.WriteInt16(header.Version, buffer, stream);
     ByteBufHelper.WriteInt32(header.Opaque, buffer, stream);
     ByteBufHelper.WriteInt32(header.Flag, buffer, stream);
     ByteBufHelper.WriteInt16(header.RequestCode, buffer, stream);
 }
예제 #2
0
        private RemotingHeader DecodeHeader(byte[] buffer, InputStream stream)
        {
            var header = new RemotingHeader();

            //skip magic code
            ByteBufHelper.ReadInt32(buffer, stream);

            header.Code        = ByteBufHelper.ReadInt16(buffer, stream);
            header.Version     = ByteBufHelper.ReadInt16(buffer, stream);
            header.Opaque      = ByteBufHelper.ReadInt32(buffer, stream);
            header.Flag        = ByteBufHelper.ReadInt32(buffer, stream);
            header.RequestCode = ByteBufHelper.ReadInt16(buffer, stream);
            return(header);
        }