Пример #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 UdpServerLite();
            App    = new TestApplication();
            var sysid = "Test".ToCharArray().Select(a => (byte)a).ToArray();
            var appid = "App1".ToCharArray().Select(a => (byte)a).ToArray();

            var sc = ServerConfig.Create()
                     .SetSysId(sysid)
                     .SetApplicationData(appid)
                     .BindApplication(Program.App)
                     .SetTimeout(TimeSpan.FromSeconds(10))

                     .SetLocalIpep(ipep)
                     .SetMaxPlayer(8)
            ;

            Server.Start(sc);
        }
Пример #2
0
        public static void StartServer1(IPEndPoint ipep)
        {
            Server = new UdpServerLite();
            App    = new TestApplication();
            var sysid = "Test".ToCharArray().Select(a => (byte)a).ToArray();
            var appid = "App1".ToCharArray().Select(a => (byte)a).ToArray();

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

            Server.Start(sc);
        }