예제 #1
0
        public static void Main(string[] args)
        {
            DoTcpMessageServerTest();
            return;

            //do
            //{
            //    int key = Console.Read();
            //    if (key == 'q') break;
            //} while (true);
            //return;

            MsgUser user = new MsgUser()
            {
                from     = "ahai",
                to       = "gca",
                username = "******",
                role     = "admin"
            };

            byte[]  msg   = ProtobufSerializer.Serialize(user);
            MsgUser user1 = ProtobufSerializer.Deserialize(msg, 0, msg.Length) as MsgUser;

            MsgLogin login = new MsgLogin("ahai", "ysh19680215")
            {
                from = "ahai",
                to   = "gca",
            };

            byte[]   msg2   = ProtobufSerializer.Serialize(login);
            MsgLogin login2 = (MsgLogin)ProtobufSerializer.Deserialize(msg2, 0, msg2.Length);

            return;
        }
        public void OnUserRegister(object sender, MessageHeader msghdr)
        {
            MsgUser user = (MsgUser)msghdr;

            Log.Debug($"OnUserLogin() user:{user.username} password:{user.password}");
        }