public static void Process(ClientSocket user, byte[] packet) { var msgBench = (MsgBench)packet; msgBench = MsgBench.Create(new byte[64], false); user.Send(msgBench); }
public static async Task Main() { FConsole.WriteLine("Host: "); ServerHostname = Console.ReadLine().Trim(); Client.OnConnected += Connected; Client.OnPacket += PacketRouter.Handle; Client.OnDisconnect += Disconnected; Client.ConnectAsync(ServerHostname, ServerPort); while (true) { var msg = Console.ReadLine(); switch (msg) { case "login": Client.Send(MsgLogin.Create("asd", "asdasd", true, MsgLoginType.Login)); break; case "ping": var array = new byte[MsgBench.MAX_ARRAY_LENGTH]; var random = new Random(); for (var i = 0; i < array.Length; i++) { array[i] = (byte)random.Next(0, 255); } Stopwatch.Start(); for (var i = 0; i < 1000; i++) { var msgBench = MsgBench.Create(array, false); Client.Send(msgBench); } break; case "send": var user = (User)Client.StateObject; FConsole.WriteLine("Requesting Token..."); user.Send(MsgToken.Create("transcoder", 0, true)); while (!user.Tokens.ContainsKey(0)) { Thread.Sleep(1); } FConsole.WriteLine("Uploading... using " + user.Tokens[0]); Stopwatch.Start(); await user.SendFile(@"/home/alumni/transcoder", 0); Stopwatch.Stop(); FConsole.WriteLine($"Done. {Stopwatch.Elapsed.TotalSeconds.ToString("##.##")}"); break; } } }
public void Setup() { CachedMsg = MsgBench.Create(new byte[100_000], true);
public static void Process(User user, MsgBench packet) { Program.Stopwatch.Stop(); FConsole.WriteLine("Took: " + Program.Stopwatch.Elapsed.TotalMilliseconds.ToString("0.00")); Program.Stopwatch.Restart(); }