Skip to content

SocketWrapper: Refactoring Socket management#227

Open
leonardocavagnis wants to merge 7 commits intoarduino:mainfrom
leonardocavagnis:eth_wrapper_fix
Open

SocketWrapper: Refactoring Socket management#227
leonardocavagnis wants to merge 7 commits intoarduino:mainfrom
leonardocavagnis:eth_wrapper_fix

Conversation

@leonardocavagnis
Copy link
Copy Markdown
Member

No description provided.

@leonardocavagnis
Copy link
Copy Markdown
Member Author

After investigation, the issue comes from the destructor in libraries/SocketWrapper/SocketWrapper.h:

~ZephyrSocketWrapper() {
    if (sock_fd != -1) {
         ::close(sock_fd);
    }
}

Removing these lines prevents the socket from being closed unexpectedly, and the Telnet session works as expected.
I’ve opened the PR with this change, but this is likely not the correct long-term fix.

Tagging @andreagilardoni to see if he can help point us toward the right approach.

@leonardocavagnis leonardocavagnis marked this pull request as ready for review November 11, 2025 12:14
@leonardocavagnis leonardocavagnis changed the title Socket Wrapper: fix close and connected functions SocketWrapper: Refactoring Socket management Nov 11, 2025
@leonardocavagnis leonardocavagnis force-pushed the eth_wrapper_fix branch 3 times, most recently from a22d972 to 51563e5 Compare November 11, 2025 14:48
Comment thread libraries/Ethernet/examples/AdvancedChatServer/AdvancedChatServer.ino Outdated
Comment thread libraries/SocketWrapper/SocketWrapper.h Outdated
Comment thread libraries/SocketWrapper/SocketWrapper.h Outdated
Comment thread libraries/SocketWrapper/SocketWrapper.h Outdated
Comment thread libraries/SocketWrapper/SocketWrapper.h Outdated
Comment thread libraries/SocketWrapper/ZephyrClient.h Outdated
Comment thread libraries/SocketWrapper/ZephyrServer.h Outdated
@leonardocavagnis leonardocavagnis force-pushed the eth_wrapper_fix branch 2 times, most recently from 3a8b676 to 472ebb4 Compare November 14, 2025 15:21
andreagilardoni
andreagilardoni previously approved these changes Dec 2, 2025
@leonardocavagnis
Copy link
Copy Markdown
Member Author

Please note that the code in this PR is fully functional and addresses issue #251. The encountered 'single connection' limitation does not stem from this library's logic, but from an incorrect Zephyr network configuration (see PR: #351).

cc @pennam

@pennam pennam force-pushed the eth_wrapper_fix branch 2 times, most recently from d88cf20 to 3605386 Compare March 4, 2026 10:14
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 18, 2026

CLA assistant check
All committers have signed the CLA.

@leonardocavagnis leonardocavagnis force-pushed the eth_wrapper_fix branch 3 times, most recently from 3ec7b5c to 152c798 Compare April 21, 2026 11:17
@github-actions
Copy link
Copy Markdown

Built 0.55.0-rc1-0.dev+70ab00c8

CI run PASSED 🟢

ArtifactBoardCoreTestsRAMSketchesWarningsErrors
zephyr_contrib ek_ra8d1 📗

11.9%

2--
frdm_mcxn947 6 🏷️

58.0%

2--
frdm_rw612 2 🏷️

83.0%

2--
✔️* zephyr_main giga 4 🏷️ ✅*

54.6%

5612-
nano33ble 1 🏷️ ✅*

78.8%

2810-
nano_matter 📗 ✔️*

⚠️ 85.7%

208(2*)
nicla_vision 4 🏷️ ✔️*

56.9%

5012(10*)
niclasense 2 🏷️ ✅*

⚠️ 87.4%

2610-
opta 4 🏷️ ✅*

56.5%

6228-
portentac33 3 🏷️ ✔️*

⚠️ 95.2%

6428(8*)
portentah7 3 🏷️ ✅*

57.2%

7228-
✅* zephyr_unoq unoq 📗 ✅*

26.9%

748-
Legend

BoardTestStatus description
🔥 🔥 Test run failed to complete.
🔴 Test completed with unexpected errors.
✔️* 🚫 Test completed with errors, but all are known/expected.
✅* 🟡 Test completed with some warnings; no errors detected.
🟢 Test passed successfully, with no warnings or errors.
🌑 🌑 Test was skipped.

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.

Telnet connection closes immediately when running Zephyr-adapted Advanced Chat Server example

3 participants