-
Notifications
You must be signed in to change notification settings - Fork 2k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
examples: add TCP echo server & client from documentation #16739
Conversation
29715c2
to
e44672b
Compare
Why single out the TCP example? Why not the UDP, IP, or DTLS examples? |
Well we should have those as runnable code too, but we got to start somewhere 😉 |
d2138cc
to
03734c1
Compare
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.
IMHO this could also be one application. The client could go in one C-file and the server in another. Sure, the resulting binary then has both functionalities, but I don't think that is harmful and maybe even a bit easier for newcomers to grasp.
(and we should call it |
ddfc5d9
to
7350366
Compare
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 is missing a README ;-)
@brummer-simon I just noticed something now that client and server are combined into the same application:
With
|
This makes sence. By default GNRC_TCP has a preallocated memory for a single receive buffer. If you want to maintain multiple connections at the same time you must increase CONFIG_GNRC_TCP_RCV_BUFFERS to something above 1. With IPv6 usage each receive buffer in use tries to allocate have at least 1220 Byte from the preallocated memory. To keep memory consumption low GNRC_TCP preallocates only enough space for a single connection by default. |
Shouldn't |
IIRC, the current |
b3297bc
to
f34ed11
Compare
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.
lgtm, I trust your testing.
Maybe convert to XFA style shell commands? (Sorry for the suggestions not being multiline, I somehow cannot select multiple lines on the phone.)
Ping @benpicco |
seems like this is mergable just some small improvements to the coding style |
Ping? |
16c6ba5
to
23b1398
Compare
23b1398
to
ff77ae8
Compare
Looks like the Makefile.ci needs bumping |
ff77ae8
to
f2d5a4c
Compare
Contribution description
The TCP sock API comes with an TCP echo example server & client.
But since this is never compiled and run it contained hidden bugs and is generally inconvenient as no Makefile is included.
Move this code to a proper example to it can be easily build & run for LWIP and GNRC TCP implementations.
Testing procedure
You can run all the tests on
native
usingnc
as the other end:server mode
Send some data from Linux
client mode
Start a server on Linux
Send some data in RIOT
Receive it on Linux
Issues/PRs references
depend on and includes #16741
#16494