Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public bool IsAnswer(FPData data)
        {
            if (data != null)
            {
                return(2 == data.GetMtype());
            }

            return(false);
        }
Ejemplo n.º 3
0
        public bool IsTwoWay(FPData data)
        {
            if (data != null)
            {
                return(1 == data.GetMtype());
            }

            return(false);
        }
Ejemplo n.º 4
0
        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);
            }
        }
Ejemplo n.º 5
0
 public bool IsAnswer(FPData data)
 {
     return(2 == data.GetMtype());
 }
Ejemplo n.º 6
0
 public bool IsTwoWay(FPData data)
 {
     return(1 == data.GetMtype());
 }
Ejemplo n.º 7
0
 public bool IsOneWay(FPData data)
 {
     return(0 == data.GetMtype());
 }