Exemplo n.º 1
0
        public void OnTransportWrite(ITcpSession session, ref WrappedWriter writer, WrappedArgs args)
        {
            var buffer = args.Value as byte[];

            writer.Write(buffer);
            writer.Write(this.symbol);
        }
Exemplo n.º 2
0
 public void OnTransportWrite(IUdpSession session, ref WrappedWriter writer, WrappedArgs args)
 {
     byte[] bytes = args.Value as byte[];
     if (bytes != null)
     {
         writer.Write(bytes.Length);
         writer.Write(bytes);
     }
 }
Exemplo n.º 3
0
        public void OnTransportWrite(ITcpSession session, ref WrappedWriter writer, WrappedArgs args)
        {
            var buffer = args.Value as byte[];

            if (buffer.Length > this.maxPackLength)
            {
                throw new Exception("pack length error!!!" + buffer.Length);
            }

            writer.Write((int)buffer.Length);
            writer.Write(buffer);
        }
Exemplo n.º 4
0
        public void OnTransportWrite(IUdpSession session, ref WrappedWriter writer, WrappedArgs args)
        {
            //Console.WriteLine($"{nameof(UdpFilter_2)}.{nameof(OnTransportWrite)}");
            var buffer = args.Value as byte[];

            writer.Write(buffer);
        }
Exemplo n.º 5
0
        public override void OnUdpMessageOutput(IUdpSession session, ref WrappedWriter writer, WrappedArgs args)
        {
            IWrappedMemory memory = args.Value as IWrappedMemory;

            if (memory.Flag == MemoryFlag.Kcp)
            {
                //kcp协议
                writer.Write(k_message);
            }
            else if (memory.Flag == MemoryFlag.Udp)
            {
                //普通udp协议
                writer.Write(c_message);
            }

            writer.Write(memory.GetReadableMemory());
        }
Exemplo n.º 6
0
 public void OnTransportWrite(IKcpSession session, ref WrappedWriter writer, WrappedArgs args)
 {
     byte[] bytes = args.Value as byte[];
     //Console.WriteLine("kcp pipeline写入数据>>" + bytes.Length);
     writer.Write(bytes);
 }