Exemplo n.º 1
0
        public bool Request(string proto, SpObject args, int session, SpStream stream)
        {
            SpStream encode_stream = EncodeRequest(proto, args, session);

            encode_stream.Position = 0;
            return(SpPacker.Pack(encode_stream, stream));
        }
Exemplo n.º 2
0
        public SpStream Response(int session, SpObject args)
        {
            SpObject header = new SpObject();

            header.Insert("session", session);

            SpStream encode_stream = new SpStream();

            mHostTypeManager.Codec.Encode(mHeaderType, header, encode_stream);

            if (session != 0 && mSessions.ContainsKey(session))
            {
                mHostTypeManager.Codec.Encode(mSessions[session].Response, args, encode_stream);
            }

            SpStream pack_stream = new SpStream();

            encode_stream.Position = 0;
            SpPacker.Pack(encode_stream, pack_stream);

            pack_stream.Position = 0;
            return(pack_stream);
        }