Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sometimes pcap_sendpacket takes longer in some situations #619

Open
s5suzuki opened this issue Jul 29, 2022 · 4 comments
Open

Sometimes pcap_sendpacket takes longer in some situations #619

s5suzuki opened this issue Jul 29, 2022 · 4 comments

Comments

@s5suzuki
Copy link

I have noticed that pcap_sendpacket sometimes takes a long time while playing a video in Windows Media Player or any other video player.
Usually, this function finishes in about 20us, but it frequently takes up to 1000us while playing video.
The same problem occurs when opening sites such as YouTube with Chrome, while normal browsing does not cause the problem.
I just executed the "Examples-pcap/sendpack" example included in the Npcap SDK.

Interestingly, this problem occurs with "Realtek PCIe GBE Family Controller" and "Intel(R) Gigabit CT Desktop Adapter," but not with "ASIX AX88179 USB 3.0 to Gigabit Ethernet Adapter".

Does anyone have any idea what might be causing this problem?

Diagnostic information

  • Windows version: Windows 11 Version 21H2, OS Build 22000.832)
    • I have confirmed that the same problems occur on other Windows 10 and Windows 11 machines.
  • npcap version: 1.70
  • npcap SDK version: 1.13
@SylvainSalle
Copy link

We have a similar issue, using pcap_sendqueue_transmit. Sending a paquet will sometimes (randomly) take more than 20 seconds instead of a few milliseconds.
The circonstances of this bug are not really clear.
One thing we did that seemed to help is to stop using the last milliseconds of the current second when we use the transmit function, like in the following code:

//avoid pcap end second bug
ts = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
if (ts % 1000 > 900)
	std::this_thread::sleep_for(std::chrono::milliseconds(1000 - (ts % 1000)));
unsigned int res = pcap_sendqueue_transmit(mp_adapter, squeue, TRUE);

It helps, but doesn't really solve the issue. Has anyone else encountered this?

Diagnostic information

  • Windows version: Windows 10 Version 21H2 / Windows 10 Version 22H1
  • npcap version: 1.60

@lk-davidegironi
Copy link

As @kayoub5 mentioned, I've also a latency issue with pcap_sendpacket, mine is called by sharppcap.
Tried different NIC and different PC but things does not change.

@s5suzuki
Copy link
Author

s5suzuki commented Jan 3, 2023

FYI, I have noticed that this problem also occurs when playing a local video and when Microsoft Teams is running (even in the background).

@lk-davidegironi
Copy link

FYI, I have noticed that this problem also occurs when playing a local video and when Microsoft Teams is running (even in the background).

Thanks you! Not my case unluckily

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants