Skip to content

Conversation

@theodorus0
Copy link

In issue #2 it was suggested to add WinDivertSendEx and WinDivertRecvEx to support async IO. I don't know how to work with Windows's Overlapped API (which is used in these -Ex functions), but i managed to wrap recv() and send() into async functions using loop.run_in_executor() from asyncio.

@theodorus0 theodorus0 closed this Nov 28, 2024
@theodorus0 theodorus0 reopened this Dec 2, 2024
@theodorus0
Copy link
Author

I have rewritten it to use Windows' Overlapped API. In my previous commit it was hard to stop code with Ctrl-C because it was running in separate thread. Now it runs in same thread as the code and there is no problem now. Also, solution with overlapped api seems to be more correct

@FinBird
Copy link

FinBird commented Dec 15, 2024

Any example or benchmark, please?

@theodorus0
Copy link
Author

Frankly speaking, I don't know how to reliably measure throughput of such programs.
I tried to run recv_async() in main thread and loop that sends packets in other thread. But even if I take the average of 100 packets, results vary a lot. Anyway, I get something from 200KB to 1MB. Are these numbers real or not is a good topic to do research on.

Also, I think this doesn't relate specifically to this PR, but rather to whole Pydivert, so maybe it should be discussed in another issue

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

Successfully merging this pull request may close these issues.

2 participants