Ejemplo n.º 1
0
        public override void SendMessages(int messageCount, TransmissionType transmissionType)
        {
            var channel = Kcp2kBenchmark.GetChannel(transmissionType);

            for (int i = 0; i < messageCount; i++)
            {
                Broadcast(MessageBuffer, channel);
            }
        }
Ejemplo n.º 2
0
        public override void SendMessages(int messageCount, TransmissionType transmissionType)
        {
            var channel = Kcp2kBenchmark.GetChannel(transmissionType);

            for (int i = 0; i < messageCount; i++)
            {
                Send(Message, channel);
            }
            Tick();
        }
Ejemplo n.º 3
0
        public EchoServer(Configuration config, BenchmarkStatistics benchmarkStatistics) : base(config)
        {
            this.config = config;
            this.benchmarkStatistics = benchmarkStatistics;
            communicationChannel     = Kcp2kBenchmark.GetChannel(config.Transmission);


            var interval = (uint)Utilities.CalculateTimeout(config.ServerTickRate);

            server = new KcpServer(OnConnected, OnReceiveMessage, OnDisconnected, DualMode, NoDelay, interval);

            serverThread          = new Thread(TickLoop);
            serverThread.Name     = "Kcp2k Server";
            serverThread.Priority = ThreadPriority.AboveNormal;
        }
Ejemplo n.º 4
0
        public EchoClient(int id, Configuration config, BenchmarkStatistics benchmarkStatistics) : base(config)
        {
            this.id     = id;
            this.config = config;
            this.benchmarkStatistics = benchmarkStatistics;
            noDelay = true;
            communicationChannel = Kcp2kBenchmark.GetChannel(config.Transmission);

            client = new KcpClientConnection();

            client.OnAuthenticated = OnPeerConnected;
            client.OnData          = OnNetworkReceive;
            client.OnDisconnected  = OnPeerDisconnected;

            tickThread              = new Thread(TickLoop);
            tickThread.Name         = $"Kcp2k Client {id}";
            tickThread.IsBackground = true;

            isConnected = false;
            isDisposed  = false;
        }