Exemple #1
0
        public static void StartServer4(IPEndPoint ipep)
        {
            KcpServer.KcpSetting.Default.RTO             = 1;
            KcpServer.KcpSetting.Default.NoDelay         = 1;
            KcpServer.KcpSetting.Default.NoDelayInterval = 1;
            KcpServer.KcpSetting.Default.NoDelayResend   = 10;
            KcpServer.KcpSetting.Default.NoDelayNC       = 1;
            KcpServer.KcpSetting.Default.RecWindowSize   = 1024;
            KcpServer.KcpSetting.Default.SndWindowSize   = 1024;
            KcpServer.KcpSetting.Default.MTU             = Utilities.PackSettings.MAX_DATA_LEN;


            Server = new KcpServer.KcpServer();
            App    = new TestApplication();
            var sysid = "Test".ToCharArray().Select(a => (byte)a).ToArray();
            var appid = "App1".ToCharArray().Select(a => (byte)a).ToArray();

            var sc = KcpServer.ServerConfig.Create()
                     .SetSysId(sysid)
                     .SetApplicationData(appid)
                     .BindApplication(Program.App)
                     .SetTimeout(TimeSpan.FromSeconds(10))
                     .SetFiberPool(new Utilities.FiberPool(8))
                     .SetLocalIpep(ipep)
                     .SetMaxPlayer(8)
            ;
            var t = Server.AsyncStart(sc);

            t.Wait();
        }
Exemple #2
0
        public static void StartServer0(IPEndPoint ipep)
        {
            Server = new KcpServer.KcpServerEx();
            App    = new TestApplication();
            var sysid = "Test".ToCharArray().Select(a => (byte)a).ToArray();
            var appid = "App1".ToCharArray().Select(a => (byte)a).ToArray();

            var sc = KcpServer.ServerConfig.Create()
                     .SetSysId(sysid)
                     .SetApplicationData(appid)
                     .BindApplication(Program.App)
                     .SetTimeout(TimeSpan.FromSeconds(10))
                     .SetFiberPool(new Utilities.FiberPool(8))
                     .SetLocalIpep(ipep)
                     .SetMaxPlayer(8)
            ;
            var t = Server.AsyncStart(sc);

            t.Wait();
        }