private void btnEnviar_Click(object sender, EventArgs e) { lbTime.Text = ""; Console.WriteLine("Tamanho do buffer"); int buffer = int.Parse(txtTamanho.Text); Console.WriteLine("Quantidade de pacotes"); int pacotes = int.Parse(txtQuantidade.Text); byte[] msg = new byte[buffer]; Clock.Start(); for (int i = 0; i < pacotes; i++) { socket.Send(msg); } Clock.Stop(); var ticks = Clock.Ticks; lbTime.Text = ticks + " ms"; string log = "Tamanho do buffer: " + buffer + " quantidade de pacotes: " + pacotes + " tempo transcorrido: " + ticks + " ms"; times.Add(log); // MessageBox.Show(ticks.ToString()); }
private static void Main() { manualReset = new ManualResetEvent(false); var clientCfg = new SocketCfg("25.175.152.176", 9959, ProtocolType.SDP); Console.Title = clientCfg.ProtocolType + " - Async Client Socket Test - SDP LIBRARY"; client = SdpSocket.ClientFactory(clientCfg); client.Connect += client_Connect; client.Receive += client_Receive; client.Disconnect += client_Disconnect; client.BeginConnect(); manualReset.WaitOne(2000); var packet = new byte[16]; client.Send(packet); while (true) { Console.ReadKey(); } }