コード例 #1
0
        protected virtual void OnReceived(object sender, MalockInnetSocketStream e)
        {
            MalockNodeMessage message = null;

            using (Stream stream = e.Stream)
            {
                if (!MalockNodeMessage.TryDeserialize(e.Stream, out message))
                {
                    this.Abort();
                    return;
                }
                if (message.Command == MalockNodeMessage.SERVER_COMMAND_SYN_LOADALLINFO)
                {
                    this.LoadAllInfo(stream);
                }
                else if (message.Command == MalockNodeMessage.SERVER_COMMAND_SYN_ENTER)
                {
                    this.Enter(message);
                }
                else if (message.Command == MalockNodeMessage.SERVER_COMMAND_SYN_EXIT)
                {
                    this.Exit(message);
                }
            }
        }
コード例 #2
0
ファイル: MalockServer.cs プロジェクト: liulilittle/malock
        private void ProcessReceived(object sender, MalockSocketStream e)
        {
            MalockNodeMessage message = null;

            using (Stream stream = e.Stream)
            {
                MalockNodeMessage.TryDeserialize(stream, out message);
            }
            if (message != null)
            {
                this.ProcessMessage(e.Socket, message);
            }
        }