Beispiel #1
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;
 }
Beispiel #2
0
        public void HandleConnnect(uint responseConn)
        {
            if (this.isConnected)
            {
                return;
            }
            this.isConnected = true;

            this.RemoteConn = responseConn;
            this.kcp        = new Kcp(responseConn, this.Output);
            kcp.SetMtu(512);
            kcp.NoDelay(1, 10, 2, 1);              //fast

            HandleSend();
        }