Example #1
0
        // connect
        public KChannel(uint conn, Socket socket, IPEndPoint remoteEndPoint, KService kService) : base(kService, ChannelType.Connect)
        {
            this.Id     = conn;
            this.Conn   = conn;
            this.socket = socket;

            this.remoteEndPoint = remoteEndPoint;
            this.lastRecvTime   = kService.TimeNow;
            this.Connect(kService.TimeNow);
        }
Example #2
0
 // connect
 public KChannel(uint conn, UdpClient socket, IPEndPoint remoteEndPoint, KService kService) : base(kService, ChannelType.Connect)
 {
     this.Id             = conn;
     this.Conn           = conn;
     this.socket         = socket;
     this.parser         = new PacketParser(this.recvBuffer);
     this.remoteEndPoint = remoteEndPoint;
     this.lastRecvTime   = kService.TimeNow;
     this.Connect(kService.TimeNow);
 }
Example #3
0
 // accept
 public KChannel(uint conn, uint remoteConn, UdpClient socket, IPEndPoint remoteEndPoint, KService kService) : base(kService, ChannelType.Accept)
 {
     this.Id             = conn;
     this.Conn           = conn;
     this.RemoteConn     = remoteConn;
     this.remoteEndPoint = remoteEndPoint;
     this.socket         = socket;
     this.parser         = new PacketParser(this.recvBuffer);
     kcp = new Kcp(this.RemoteConn, this.Output);
     kcp.SetMtu(512);
     kcp.NoDelay(1, 10, 2, 1);              //fast
     this.isConnected  = true;
     this.lastRecvTime = kService.TimeNow;
 }
Example #4
0
        // accept
        public KChannel(uint conn, uint remoteConn, Socket socket, IPEndPoint remoteEndPoint, KService kService) : base(kService, ChannelType.Accept)
        {
            this.Id             = conn;
            this.Conn           = conn;
            this.RemoteConn     = remoteConn;
            this.remoteEndPoint = remoteEndPoint;
            this.socket         = socket;
            kcp = new KCP(this.RemoteConn, this);
            kcp.SetOutput(this.Output);
            kcp.NoDelay(1, 10, 2, 1);              //fast
            kcp.SetMTU(470);
            kcp.WndSize(256, 256);
            this.isConnected = true;

            this.lastRecvTime = kService.TimeNow;
        }