Inheritance: NetworkComponent
Esempio n. 1
0
        public async void TestAsync(NetOuterComponent networkComponent, IPEndPoint ipEndPoint, int j)
        {
            try
            {
                using (Session session = networkComponent.Create(ipEndPoint))
                {
                    int i = 0;
                    while (i < 100000000)
                    {
                        ++i;
                        await Game.Scene.GetComponent <TimerComponent>().WaitAsync(10);

                        await this.Send(session, j);
                    }
                }
            }
            catch (RpcException e)
            {
                Log.Error(e.ToString());
            }
            catch (Exception e)
            {
                Log.Error(e.ToString());
            }
        }
        private async void TestAsync(NetOuterComponent networkComponent, string address, int j)
        {
            try
            {
                using (Session session = networkComponent.Create(address))
                {
                    int i = 0;
                    while (i < 10000000)
                    {
                        ++i;
                        await session.Call <C2R_Ping, R2C_Ping>(new C2R_Ping());

                        ++this.k;

                        if (this.k % 100000 != 0)
                        {
                            continue;
                        }

                        long time2 = TimeHelper.ClientNow();
                        long time  = time2 - this.time1;
                        this.time1 = time2;
                        Log.Info($"{j} Benchmark k: {this.k} 每10W次耗时: {time} ms");
                    }
                }
            }
            catch (RpcException e)
            {
                Log.Error(e.ToString());
            }
            catch (Exception e)
            {
                Log.Error(e.ToString());
            }
        }
Esempio n. 3
0
		public async void TestAsync(NetOuterComponent networkComponent, string address, int j)
		{
			try
			{
				using (Session session = networkComponent.Create(address))
				{
					int i = 0;
					while (i < 10000000)
					{
						++i;
						await session.Call<C2R_Ping, R2C_Ping>(new C2R_Ping());

						++this.k;

						if (this.k % 100000 != 0)
						{
							continue;
						}

						long time2 = TimeHelper.ClientNow();
						long time = time2 - this.time1;
						this.time1 = time2;
						Log.Info($"{j} Benchmark k: {this.k} 每10W次耗时: {time} ms");
					}
				}
			}
			catch (RpcException e)
			{
				Log.Error(e.ToString());
			}
			catch (Exception e)
			{
				Log.Error(e.ToString());
			}
		}
        public async void Awake(string address)
        {
            NetOuterComponent networkComponent = Game.Scene.GetComponent <NetOuterComponent>();

            for (int i = 0; i < 100; i++)
            {
                await Game.Scene.GetComponent <TimerComponent>().WaitAsync(10);

                TestAsync(networkComponent, address, i);
            }
        }
Esempio n. 5
0
 public void Awake(IPEndPoint ipEndPoint)
 {
     try
     {
         NetOuterComponent networkComponent = Game.Scene.GetComponent <NetOuterComponent>();
         for (int i = 0; i < 100; i++)
         {
             this.TestAsync(networkComponent, ipEndPoint, i);
         }
     }
     catch (Exception e)
     {
         Log.Error(e.ToString());
     }
 }
Esempio n. 6
0
        private async void Awake(string address)
        {
            try
            {
                NetOuterComponent networkComponent = Game.Scene.GetComponent <NetOuterComponent>();

                for (int i = 0; i < 100; i++)
                {
                    await Game.Scene.GetComponent <TimerComponent>().WaitAsync(10);

                    this.TestAsync(networkComponent, address, i);
                }
            }
            catch (Exception e)
            {
                Log.Error(e.ToString());
            }
        }
Esempio n. 7
0
 public async void TestAsync(NetOuterComponent networkComponent, string address, int j)
 {
     try
     {
         using (Session session = networkComponent.Create(address))
         {
             int i = 0;
             while (i < 100000000)
             {
                 ++i;
                 await this.Send(session, j);
             }
         }
     }
     catch (RpcException e)
     {
         Log.Error(e.ToString());
     }
     catch (Exception e)
     {
         Log.Error(e.ToString());
     }
 }