Exemplo n.º 1
0
        protected override void Encode(SocketArgEvent argEvent, object message, object output)
        {
            byte[] data = MessagePackSerializer.Serialize <object>(message);
            var    list = output as List <byte[]>;

            list.Add(data);
        }
Exemplo n.º 2
0
 protected override void Decode(SocketArgEvent context, byte[] message, List <object> output)
 {
     if (HttpQuery.IsHttp(message, 0, message.Length))
     {
         //是http请求
         output.Add(message);
     }
     else
     {
         object obj = MessagePackSerializer.Deserialize <object>(message);
         output.Add(obj);
     }
 }
Exemplo n.º 3
0
 public override void ChannelRead(SocketArgEvent argEvent, object message)
 {
     //
     if (highSocket != null)
     {
         NetChannel <T> netChannel = new NetChannel <T>();
         netChannel.channel    = argEvent.chanel;
         netChannel.localIP    = argEvent.localIP;
         netChannel.localPort  = argEvent.localPort;
         netChannel.remoteIP   = argEvent.remoteIP;
         netChannel.remotePort = argEvent.remotePort;
         netChannel.recData    = (T)message;
         highSocket.AddData(netChannel);
     }
 }