asmrobot
2024-12-31 a8536c3c73a4445b1f1252a1d3271e0c73b35613
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
using System;
using System.Collections.Generic;
using System.Text;
using waxbill;
using waxbill.Packets;
using waxbill.Pools;
 
namespace RichCreator.Server
{
    public class RichCreatorSession : waxbill.Sessions.SessionBase
    {
        protected override void OnConnected()
        {
            Trace.Info("connected");
        }
 
        protected override void OnDisconnected(CloseReason reason)
        {
            Trace.Info("disconnected");
        }
 
        protected override void OnReceived(Packet packet)
        {
            Trace.Info("receive");
        }
 
        protected override void OnSended(SendingQueue packet, bool result)
        {
            Trace.Info("sended");
        }
 
 
        //public static TCPServer<TraderSession> TraderServer;
 
        ///// <summary>
        ///// 医生票据
        ///// </summary>
        //public Ticket Doctor
        //{
        //    get;
        //    set;
        //}
 
        ///// <summary>
        ///// 最后活动时间
        ///// </summary>
        //public Int64 LastActive
        //{
        //    get;
        //    set;
        //}
 
        //#region session interface
        //protected override void OnConnected()
        //{
        //    ZTImage.Log.Trace.Info("connect from:" + this.RemoteEndPoint.ToString());
        //}
 
        //protected override void OnDisconnected(CloseReason reason)
        //{
        //    ZTImage.Log.Trace.Info("disconnect from:" + this.RemoteEndPoint.ToString());
        //}
 
        //protected override void OnReceived(Packet packet)
        //{
        //    byte[] d = packet.Read();
        //    //Trace.Info("ip:" + this.RemoteEndPoint + "->" + ZTImage.TypeConverter.ByteArrayToString(d));
 
        //    PacketStream stream = new PacketStream(packet);
        //    if (stream.Length > 1)
        //    {
        //        stream.Position = 1;
        //    }
 
        //    byte cmd = 0;
        //    try
        //    {
        //        cmd = packet[0];
        //        HandlerBase handler = GetHandler(cmd);
        //        handler.Process(this, stream);
        //    }
        //    catch (Exception ex)
        //    {
        //        ZTImage.Log.Trace.Error("服务处理异常:", ex);
        //    }
        //}
 
        //protected override void OnSended(IList<UVIntrop.uv_buf_t> packet, bool result)
        //{ }
 
 
 
 
 
        //private HandlerBase GetHandler(byte command)
        //{
        //    switch (command)
        //    {
        //        case 0x01:
        //            //其它服务器上传检测数据
        //            return OtherServerCheckupHandler.Define;
        //        case 0x02:
        //            //其它服务器上传普通消息
        //            return OtherServerSurezenNotificationHandler.Define;
        //        case 0x11:
        //            //用户登陆
        //            return ClientLoginHandler.Define;
        //        case 0x12:
        //            //用户心跳
        //            return ClientHeartHandler.Define;
        //            //case 0x21:
        //            //    //设备登陆
 
        //            //    break;
        //            //case 0x22:
        //            //    //设备心跳
 
        //            //    break;
        //    }
 
        //    return EmptyHandler.Define;
        //}
        //#endregion
 
        //#region send
        ///// <summary>
        ///// 发送检查消息通知
        ///// </summary>
        //public void SendCheckupMessage(string codeDir, string machineNo, Int32 ct, string introduce, Int64 ts)
        //{
        //    CheckupType cType = (CheckupType)ct;
 
 
        //    CheckupMessage message = new CheckupMessage();
        //    message.OrgCode = codeDir;
        //    message.MachineNo = machineNo;
        //    message.CType = cType;
        //    message.Introduce = introduce;
        //    message.TS = ts;
 
        //    byte[] data = BinSerialHelper.SerializeMessage(message, 0x13);
        //    this.Send(data);
        //}
 
        ///// <summary>
        ///// 向客户端发送服务端通知
        ///// </summary>
        //public void SendSurezenNotification(string from, string to, string content, Int64 ts)
        //{
        //    SurezeNotification message = new SurezeNotification();
        //    message.From = from;
        //    message.To = to;
        //    message.Cotnent = content;
        //    message.Ts = ts;
 
        //    byte[] data = BinSerialHelper.SerializeMessage(message, 0x14);
        //    this.Send(data);
        //}
        //#endregion
 
    }
}