Beispiel #1
0
        private void HandleMsg(Connection con, ProtocolBase protocolBase)
        {
            string        name = protocolBase.GetName();
            ProtocolBytes pro  = (ProtocolBytes)protocolBase;
            int           num  = pro.GetInt(0);

            Console.WriteLine("[收到协议]:" + name + num);
            if (name == "HeartBeat")
            {
                // Console.WriteLine("[更新心跳时间]:" + con.GetAddress());
                con.lastTicketTime = Sys.GetTimeStamp();
            }
        }
Beispiel #2
0
        private void ShowMessage(ProtocolBytes data, int cmd)
        {
            Console.WriteLine("");
            Console.WriteLine("");
            switch (cmd)
            {
            case 1:
            {
                Console.WriteLine("收到发消息Ip:[" + data.GetString() + "]" + "日期:" + data.GetString());
                Console.WriteLine("消息:" + data.GetString());
                break;
            }

            case 2:
            case 3:
            {
                Console.WriteLine(data.GetString());
                break;
            }
            }

            Console.WriteLine("");
            Console.Write("发送消息:");
        }