Repository navigation
Add Windows support and native PlatformIO test coverage - #24
Merged
Merged
Conversation
Owner
|
Review of PR #24 found 4 issues, ranked by severity:
|
Contributor
Author
All addressed. |
David-Vandensteen
pushed a commit
to David-Vandensteen/Arduino-Emulator
that referenced
this pull request
Oct 21, 2026
…ortability work Merges the connect-timeout feature from PR pschatzmann#21 (timeout-aware EthernetClient/SocketImpl connect(), aligning behavior with ESP32/Pico Arduino cores) onto main, which had since gained Windows portability support (PR pschatzmann#24) that PR pschatzmann#21 predates. Conflicts were in Ethernet.h's connect()/resolveAddress() (both PRs touched the same functions). Beyond conflict resolution, this adds what PR pschatzmann#21 was missing for the now-merged Windows target and closes gaps found in review: - SocketImplWindows.cpp: add the 3-arg connect(address, port, timeout_ms) override (nonblocking connect + select()), and fix read()'s signature/semantics to match the updated SocketImpl contract (int return, -1 on error/EOF, 0 on would-block). - NetworkClientSecure.h: add the missing 3-arg connect() override on SocketImplSecure - without it, EthernetClient::connect() routed through the new 3-arg virtual and silently bypassed the TLS handshake for every NetworkClientSecure user. - Ethernet.h: bound hostname resolution by timeout_ms using a background thread + future, so connect(host, port, timeout_ms) stays bounded even when DNS is slow (getaddrinfo has no timeout of its own), deducting the time spent from the budget passed to the subsequent TCP connect. - test/native/test_native.cpp: add deterministic connect-refused and connect-timeout tests (the latter POSIX-only, guarded because Winsock's behavior on a saturated accept queue isn't verified here). Verified with the existing native unity suite (11/11 passing, repeated runs), plus manual runtime checks of TLS connect/handshake, refused-connection, and timeout paths against a local wolfSSL build. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Windows support to the desktop Arduino emulator while preserving the existing POSIX/Linux implementation. Tested on both Windows and Ubuntu.
Changes
Testing
Verified with:
pio test -e nativeAll 9 native tests passed, including GPIO delegation, SD filesystem operations, UDP loopback, TCP loopback, socket error mapping, Arduino types, and timing behavior.