public static void Awake(this BenchmarkComponent self, string address) { try { IPEndPoint ipEndPoint = NetworkHelper.ToIPEndPoint(address); NetOuterComponent networkComponent = Game.Scene.GetComponent<NetOuterComponent>(); for (int i = 0; i < 2000; i++) { self.TestAsync(networkComponent, ipEndPoint, i); } } catch (Exception e) { Log.Error(e); } }
public static async void TestAsync(this BenchmarkComponent self, NetOuterComponent networkComponent, IPEndPoint ipEndPoint, int j) { try { using (Session session = networkComponent.Create(ipEndPoint)) { int i = 0; while (i < 100000000) { ++i; await self.Send(session, j); } } } catch (Exception e) { Log.Error(e); } }