[riot-notifications] [RIOT-OS/RIOT] sock_dtls: add timeout to sock_dtls_send and add sock_dtls_session_init (#14043)

Martine Lenders notifications at github.com
Mon May 18 10:59:11 CEST 2020


@miri64 commented on this pull request.



>          puts("Error sending data");
     }
     else {
         printf("Sent DTLS message\n");
 
         uint8_t rcv[512];
-        if (sock_dtls_recv(&dtls_sock, &session, rcv, sizeof(rcv), SOCK_NO_TIMEOUT) < 0) {
-            printf("Error receiving DTLS message\n");
-        }
-        else {
-            printf("Received DTLS message\n");
+        if ((res = sock_dtls_recv(&dtls_sock, &session, rcv, sizeof(rcv),
+                                    SOCK_NO_TIMEOUT)) > 0) {
+            printf("Received %d bytes\n", (int)res);

I'm not sure this is a good idea for the server, mostly application-wise:

1. The server is able to handle any received data, including non-printable data, while the client only expects what it sends (a printable string), since the server is an echo server.
2. The server is an echo server, so why does it need to print the data it echos?

I'd say, keep printing just the number of bytes for the server.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/14043#discussion_r426472602
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20200518/26322058/attachment-0001.htm>


More information about the notifications mailing list