I’m unable to achieve a delay between requests of less than 50 microseconds (10 microseconds is required). No optimizations, such as running on multiple warmed-up threads, seem to help (apparently, there’s some kind of lock under the hood). The requests are sent via an Ethernet cable. Are there any other settings or approaches that could help reduce the delay?
_device.OnPacketArrival += ProcessPacketArrival;
_device.Open(DeviceModes.MaxResponsiveness | DeviceModes.NoCaptureLocal, -1);
_device.NonBlockingMode = true;
_device.StartCapture();
//delay between requests 50+ microseconds
_device.SendPacket(_cachedBytes.AsSpan());
_device.SendPacket(_cachedBytes.AsSpan());
Tried: various configurations, multithreading and etc.
Expect: delay between requests not more than 10 microseconds.
Solved: In my case, the solution was to use the SendQueue class from SharpPcap. Setting the size in the constructor and adding messages via SendQueue.Add with the required number of packets, you can then call _sendQueue.Transmit. In my scenario, the timeout between requests is about 5 microseconds, and between Transmits, it’s 24 milliseconds.
Im Here is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
3