Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.3k
extmod/modlwip,esp32,unix: Add support for socket recv flags argument#17312
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Code size report:
|
codecovbot commentedMay 16, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@## master #17312 +/- ##======================================= Coverage 98.54% 98.54% ======================================= Files 169 169 Lines 21898 21898 ======================================= Hits 21579 21579 Misses 319 319 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This looks good, thanks!
I tested on ESP8266, RPI_PICO2_W-RISCV and ESP32_GENERIC, and all the new tests pass.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
2308215
to3c2eaf3
Compareprojectgus commentedMay 30, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Have updated the tests and run on various ports (updated in description), but have found what looks like a lower level issue on RPI_PICO_W and RPI_PICO2_W. The new |
3c2eaf3
to14f7f61
CompareUh oh!
There was an error while loading.Please reload this page.
projectgus commentedMay 30, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
One interesting thing in the output with
But the runs which fail always seem to be:
Weirdly this ordering seems to be happening internal to the CYW43 module, packet captures of successful runs on the Wi-Fi AP always show the second ordering over the air (RX, RX, TX) even though the trace log shows (RX, TX, RX). |
Uh oh!
There was an error while loading.Please reload this page.
355ef35
to7f76f49
CompareImplements MSG_PEEK and MSG_DONTWAIT.This work was funded through GitHub Sponsors.Signed-off-by: Angus Gratton <angus@redyak.com.au>
Implements MSG_PEEK and MSG_DONTWAIT (both passed through to LWIPsockets API).This work was funded through GitHub Sponsors.Signed-off-by: Angus Gratton <angus@redyak.com.au>
This work was funded through GitHub Sponsors.Signed-off-by: Angus Gratton <angus@redyak.com.au>
Adds TCP and UDP multi_net test cases.This work was funded through GitHub Sponsors.Signed-off-by: Angus Gratton <angus@redyak.com.au>
Adding multi_net case for UDP only, as TCP timing is hard to test reliably.Signed-off-by: Angus Gratton <angus@redyak.com.au>
Implementation added for various ports in the parent commits.This work was funded through GitHub Sponsors.Signed-off-by: Angus Gratton <angus@redyak.com.au>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I've re-reviewed this, it looks good.
I also tested on PYBD_SF2, RPI_PICO_W and ESP32_GENERIC. The new tests all pass, and so do existing ones (with known failures).
7f76f49
toba92063
Compareba92063
intomicropython:masterUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Summary
Goal of this PR is to have support for the
MSG_DONTWAIT
andMSG_PEEK
flags for socketrecv
&recvfrom
on unix, esp32, and all "bare metal" LWIP ports.MSG_PEEK
constant is now exposed to Python code.flags
argument.Note: Zephyr & CC3200 ports have their own
socket
module implementations, support not added to these yet. Zephyr looks like it would be trivially easy, CC3200 I didn't look into.Testing
Trade-offs and Alternatives
MSG_PEEK
is motivated by wanting to improve the DTLS support. AddingMSG_DONTWAIT
as well was relatively easy, and both of these flags are potentially useful for socket programming on MicroPython. However I guess the obvious alternative is not to add them, or to implement them via a Python wrapper in the Python socket module (which would be hacky but possible).