public static RpcTcpBinaryHeader Parse(byte[] buffer) { MemoryStream stream = new MemoryStream(buffer); BinaryReader reader = new BinaryReader(stream); int mark = reader.ReadInt32(); if (mark != MagicStartMark) { throw new FormatException("Unexcepted Header"); } RpcTcpBinaryHeader header = new RpcTcpBinaryHeader(); header.Sequence = reader.ReadInt32(); header.HeaderSize = reader.ReadInt32(); header.BodySize = reader.ReadInt32(); return header; }
public static RpcTcpBinaryHeader Parse(byte[] buffer) { MemoryStream stream = new MemoryStream(buffer); BinaryReader reader = new BinaryReader(stream); int mark = reader.ReadInt32(); if (mark != MagicStartMark) { throw new FormatException("Unexcepted Header"); } RpcTcpBinaryHeader header = new RpcTcpBinaryHeader(); header.Sequence = reader.ReadInt32(); header.HeaderSize = reader.ReadInt32(); header.BodySize = reader.ReadInt32(); return(header); }