Ejemplo n.º 1
0
        // connect
        public KChannel(uint localConn, Socket socket, IPEndPoint remoteEndPoint, KService kService) : base(kService, ChannelType.Connect)
        {
            memoryStream = GetService().MemoryStreamManager.GetStream("message", ushort.MaxValue);

            LocalConn           = localConn;
            this.socket         = socket;
            this.remoteEndPoint = remoteEndPoint;
            lastRecvTime        = kService.TimeNow;
            createTime          = kService.TimeNow;
            Connect();
        }
Ejemplo n.º 2
0
        // accept
        public KChannel(uint localConn, uint remoteConn, Socket socket, IPEndPoint remoteEndPoint, KService kService) : base(kService, ChannelType.Accept)
        {
            memoryStream = GetService().MemoryStreamManager.GetStream("message", ushort.MaxValue);

            LocalConn           = localConn;
            RemoteConn          = remoteConn;
            this.remoteEndPoint = remoteEndPoint;
            this.socket         = socket;
            kcp = Kcp.KcpCreate(RemoteConn, new IntPtr(LocalConn));

            SetOutput();
            Kcp.KcpNodelay(kcp, 1, 10, 1, 1);
            Kcp.KcpWndsize(kcp, 256, 256);
            Kcp.KcpSetmtu(kcp, 470);
            lastRecvTime = kService.TimeNow;
            createTime   = kService.TimeNow;
            Accept();
        }
Ejemplo n.º 3
0
 public static int KcpOutput(IntPtr bytes, int len, IntPtr kcp, IntPtr user)
 {
     KService.Output(bytes, len, user);
     return(len);
 }