Add TCP Listen and Accept#196
Conversation
There was a problem hiding this comment.
Pull request overview
Adds TCP server support to the Serial Modem AT socket layer by documenting and implementing AT#XLISTEN / AT#XACCEPT, plus extending AT#XSOCKET? output to include remote peer info for accepted sockets.
Changes:
- Extend
AT#XSOCKET?read response to optionally include accepted peer address/port. - Add
AT#XLISTEN(listen) andAT#XACCEPT(accept) AT commands in implementation and docs. - Update unit tests and test harness wiring (AT wrapper routing + kernel alloc stubs) to cover listen/accept behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| doc/app/at_socket.rst | Documents #XLISTEN / #XACCEPT and extends #XSOCKET? response format with peer info. |
| app/src/sm_at_socket.c | Implements listen/accept, tracks bound port + listen state, and stores peer address for accepted sockets. |
| app/tests/at_socket/src/nrf_modem_at_wrapper.c | Routes AT#XLISTEN / AT#XACCEPT to custom-command wrappers in tests. |
| app/tests/at_socket/src/test_at_socket.c | Adds tests for listen/accept and updates socket-count assumptions. |
| app/tests/at_socket/CMakeLists.txt | Links new kernel stubs into the at_socket test target. |
| app/tests/stubs/kernel_stubs.c | Provides k_malloc/k_free stubs for the unit-test environment. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
trantanen
left a comment
There was a problem hiding this comment.
Going through doc and parts of code.
ac3bea8 to
67ca2cf
Compare
b323581 to
917689c
Compare
|
@divipillai: Adding missing migration guide still |
917689c to
a21d44b
Compare
|
@divipillai, migration guide added, feel free to review. |
10159f9 to
caa864a
Compare
caa864a to
b664283
Compare
Add AT#XLISTEN and AT#XACCEPT for TCP server functionality. Signed-off-by: Markus Lassila <markus.lassila@nordicsemi.no>
Basic unit tests for AT#XLISTEN and AT#XACCEPT. Signed-off-by: Markus Lassila <markus.lassila@nordicsemi.no>
b664283 to
c10df75
Compare
trantanen
left a comment
There was a problem hiding this comment.
Great to have this back 😄
| __cmock_nrf_accept_Stub(mock_nrf_accept_with_peer_callback); | ||
| __cmock_zsock_inet_ntop_Stub(mock_zsock_inet_ntop_192_168_0_100_callback); |
There was a problem hiding this comment.
I don't know if there is a reason why CMockReturnMemThruPtr wouldn't work here?
You can also skip this here now. I think we have places where we could probably use it more.
Add AT#XLISTEN and AT#XACCEPT for TCP server functionality.
Jira: SM-240