public void test_network_udp_queue_rcv() { int msg_count = 0; DRRCommon.Network.UDPReciverWithTime reciver = new DRRCommon.Network.UDPReciverWithTime(19208); reciver.GetSocket().ReceiveBufferSize = 1024 * 1024 * 30; //reciver.QueueHeapCountMax = 1; Core.RecordCore core = new Core.RecordCore(new double[] { 0, 0 }, "D:/Data/test", "test", "unit test", new System.Collections.Generic.List <System.Net.IPEndPoint>() { new System.Net.IPEndPoint(IPAddress.Any, 19208) }); reciver.DataRcv_Event += (byte[] rcvBytes, System.Net.IPEndPoint point, System.DateTime time) => { msg_count++; core.Add(time.TotalSeconds(), point.Address.GetAddressBytes(), (ushort)point.Port, rcvBytes); }; reciver.QueueHeap_Event += (int heapCount) => { throw new System.Exception("Heap: " + heapCount); }; reciver.Start(); Thread.Sleep(20000); Assert.AreEqual(600_000, msg_count); }
public void test_network_udp_rcv() { int msg_count = 0; DRRCommon.Network.UDPReciverWithTime reciver = new DRRCommon.Network.UDPReciverWithTime(19208); reciver.GetSocket().ReceiveBufferSize = 1024 * 1024 * 2; reciver.DataRcv_Event += (byte[] rcvBytes, System.Net.IPEndPoint point, System.DateTime time) => { msg_count++; }; reciver.Start(); Thread.Sleep(20000); Assert.AreEqual(msg_count, 600_000); }