Skip to content
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

sock: tcp: fix sock_tcp_read() example #16743

Merged
merged 1 commit into from
Sep 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions sys/include/net/sock/tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
* while (read_res >= 0) {
* read_res = sock_tcp_read(sock, &buf, sizeof(buf),
* SOCK_NO_TIMEOUT);
* if (read_res < 0) {
* if (read_res <= 0) {
* puts("Disconnected");
* break;
* }
Expand Down Expand Up @@ -153,7 +153,7 @@
* while (read_res >= 0) {
* read_res = sock_tcp_read(sock, &buf, sizeof(buf),
* SOCK_NO_TIMEOUT);
* if (read_res < 0) {
* if (read_res <= 0) {
* puts("Disconnected");
* break;
* }
Expand Down Expand Up @@ -216,7 +216,7 @@
* }
* else {
* if ((res = sock_tcp_read(&sock, &buf, sizeof(buf),
* SOCK_NO_TIMEOUT)) < 0) {
* SOCK_NO_TIMEOUT)) <= 0) {
* puts("Disconnected");
* }
* printf("Read: \"");
Expand Down Expand Up @@ -271,7 +271,7 @@
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.c}
* else {
* if ((res = sock_tcp_read(&sock, &buf, sizeof(buf),
* SOCK_NO_TIMEOUT)) < 0) {
* SOCK_NO_TIMEOUT)) <= 0) {
* puts("Disconnected");
* }
* printf("Read: \"");
Expand Down Expand Up @@ -505,7 +505,8 @@ int sock_tcp_accept(sock_tcp_queue_t *queue, sock_tcp_t **sock,
* @note Function may block.
*
* @return The number of bytes read on success.
* @return 0, if no read data is available, but everything is in order.
* @return 0, if no read data is available or the connection was orderly closed
* by the remote host.
* @return -EAGAIN, if @p timeout is `0` and no data is available.
* @return -ECONNABORTED, if the connection is aborted while waiting for the
* next data.
Expand Down