private MemoryStream BuildHeader(FPData data, int size) { MemoryStream ms = new MemoryStream(); if (this.IsHttp(data)) { ms.Write(FPConfig.HTTP_MAGIC, 0, 4); } if (this.IsTcp(data)) { ms.Write(FPConfig.TCP_MAGIC, 0, 4); } ms.WriteByte(FPConfig.FPNN_VERSION[data.GetVersion()]); if (this.IsJson(data)) { ms.WriteByte(FPConfig.FP_FLAG[data.GetFlag()]); } if (this.IsMsgPack(data)) { ms.WriteByte(FPConfig.FP_FLAG[data.GetFlag()]); } ms.WriteByte(FPConfig.FP_MESSAGE_TYPE[data.GetMtype()]); return(ms); }
public bool IsAnswer(FPData data) { if (data != null) { return(2 == data.GetMtype()); } return(false); }
public bool IsTwoWay(FPData data) { if (data != null) { return(1 == data.GetMtype()); } return(false); }
public void SendNotify(FPData data) { if (data != null && data.GetMtype() != 0x0) { data.SetMtype(0x0); } byte[] buf = this._pkg.EnCode(data); buf = this._cry.EnCode(buf); if (buf != null) { this._sock.Write(buf); } }
public bool IsAnswer(FPData data) { return(2 == data.GetMtype()); }
public bool IsTwoWay(FPData data) { return(1 == data.GetMtype()); }
public bool IsOneWay(FPData data) { return(0 == data.GetMtype()); }