Skip to content

Commit

Permalink
samples: websocket_client: close tcp socket after websocket_disconnect
Browse files Browse the repository at this point in the history
websocket_disconnect api does not closes user tcp socket, so tcp socket
must be closed after done.

Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
  • Loading branch information
ssekar15 authored and fabiobaltieri committed Jun 19, 2023
1 parent bdb26cf commit 026d476
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions samples/net/sockets/websocket_client/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,10 +431,18 @@ int main(void)
close(websock4);
}

if (sock4 >= 0) {
close(sock4);
}

if (websock6 >= 0) {
close(websock6);
}

if (sock6 >= 0) {
close(sock6);
}

k_sleep(K_FOREVER);
return 0;
}

0 comments on commit 026d476

Please sign in to comment.