private void OnTimedEvent(object source, ElapsedEventArgs e) { float DeltaFrames = Sender.GetTotalNbDataINOUT() - PreviousNumberOfFrames; RateInBps = (float)(DeltaFrames / (float)(TimerResolutionMiliSec / 1000.0f)); RateInKBps = RateInBps / 1024.0f; RateInMBps = RateInKBps / 1024.0f; PreviousNumberOfFrames = Sender.GetTotalNbDataINOUT(); PrintInfo(); }
public void SendBytesNow_LoopBack1k() { UDPSender us = new UDPSender("127.0.0.1", 7778); byte[] data = new byte[1024 *1]; UdpClient listener = new UdpClient(7778); IPEndPoint groupEP = new IPEndPoint(IPAddress.Any, 7778); //Blocking Call us.SendBytesNow(data, 1024 * 1); //BLOCKING CALL byte[] bytes = listener.Receive(ref groupEP); Assert.AreEqual(us.GetTotalNbDataINOUT(), bytes.Length); listener.Close(); }
public void SendStringNow_TestWithSring() { UDPSender us = new UDPSender("127.0.0.1", 7777); string t = "I am testing the udp sender SendStringNow method"; us.SendStringNow(t); Assert.AreEqual(us.GetTotalNbDataINOUT(), t.Length) ; }
public void SendBytesNow_TestWith4K() { UDPSender us = new UDPSender("127.0.0.1", 7777); byte[] data = new byte[1024 * 4]; us.SendBytesNow(data, 1024 * 4); Assert.AreEqual(us.GetTotalNbDataINOUT(), 1024 * 4); }
public void SendBytesNow_TestWith10M_BufferOverflow() { UDPSender us = new UDPSender("127.0.0.1", 7777); byte[] data = new byte[1024 *1024 *10]; us.SendBytesNow(data, 1024*1024*10); Assert.AreEqual(us.GetTotalNbDataINOUT(),0); }