Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Open
projectgus wants to merge6 commits intomicropython:master
base:master
Choose a base branch
Loading
fromprojectgus:feature/socket_recv_peek

Conversation

projectgus
Copy link
Contributor

Summary

Goal of this PR is to have support for theMSG_DONTWAIT andMSG_PEEK flags for socketrecv &recvfrom on unix, esp32, and all "bare metal" LWIP ports.

  • Bare metal LWIP adds support for these flags in modlwip.c, with some refactoring to try and reduce the code size impact.
  • esp32 port now passes these flags through to the LWIP BSD socket layer, which already supports them.
  • unix port already had support for flags argument.MSG_PEEK constant is now exposed to Python code.
  • Adds multi_net tests for the new flags.
  • Adds docs for theflags argument.

Note: Zephyr & CC3200 ports have their ownsocket module implementations, support not added to these yet. Zephyr looks like it would be trivially easy, CC3200 I didn't look into.

Testing

  • Ran new and existing multi_net tests on ESP32_GENERIC_S3, RPI_PICO2_W boards.

Trade-offs and Alternatives

  • Support forMSG_PEEK is motivated by wanting to improve the DTLS support. AddingMSG_DONTWAIT 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).

AmirHmZz reacted with thumbs up emoji
Implements 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>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>
@projectgusprojectgus added port-esp32 extmodRelates to extmod/ directory in source port-unix port-rp2 labelsMay 16, 2025
@github-actionsGitHub Actions
Copy link

Code size report:

   bare-arm:    +0 +0.000% minimal x86:    +0 +0.000%    unix x64:   +56 +0.007% standard[incl +32(data)]      stm32:    +0 +0.000% PYBV10     mimxrt:    +0 +0.000% TEENSY40        rp2:   +32 +0.003% RPI_PICO_W       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS  qemu rv32:    +0 +0.000% VIRT_RV32

@codecovCodecov
Copy link

codecovbot commentedMay 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.54%. Comparing base(f48b981) to head(2308215).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@##           master   #17312   +/-   ##=======================================  Coverage   98.54%   98.54%           =======================================  Files         169      169             Lines       21897    21897           =======================================  Hits        21579    21579             Misses        318      318

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report?Share it here.

🚀 New features to boost your workflow:
  • ❄️Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
extmodRelates to extmod/ directory in sourceport-esp32port-rp2port-unix
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant
@projectgus

[8]ページ先頭

©2009-2025 Movatter.jp