]> granicus.if.org Git - esp-idf/commitdiff
fix(tw16355): examples/protocols/coap_client(server)
authorzhangjunhao <zhangjunhao@espressif.com>
Wed, 15 Nov 2017 03:58:19 +0000 (11:58 +0800)
committerzhangjunhao <zhangjunhao@espressif.com>
Wed, 15 Nov 2017 03:58:19 +0000 (11:58 +0800)
fix coap example can not work properly

examples/protocols/coap_client/main/coap_client_example_main.c
examples/protocols/coap_server/main/coap_server_example_main.c

index c9d8b22fcdf7b8f1257ba16eef735d64746c7f32..98f003e1aded7da29a3ff22a30138f91167b630a 100644 (file)
@@ -139,7 +139,7 @@ static void coap_example_task(void *p)
                     FD_ZERO(&readfds);
                     FD_CLR( ctx->sockfd, &readfds );
                     FD_SET( ctx->sockfd, &readfds );
-                    result = select( FD_SETSIZE, &readfds, 0, 0, &tv );
+                    result = select( ctx->sockfd+1, &readfds, 0, 0, &tv );
                     if (result > 0) {
                         if (FD_ISSET( ctx->sockfd, &readfds ))
                             coap_read(ctx);
index 47f47dfc5d4c7f877d222ec1bf1e18b67627b361..b3ea70308008a56785a6271ea0bf82bc33c666f7 100644 (file)
@@ -120,7 +120,7 @@ static void coap_example_thread(void *p)
                     FD_CLR( ctx->sockfd, &readfds);
                     FD_SET( ctx->sockfd, &readfds);
 
-                    int result = select( FD_SETSIZE, &readfds, 0, 0, &tv );
+                    int result = select( ctx->sockfd+1, &readfds, 0, 0, &tv );
                     if (result > 0){
                         if (FD_ISSET( ctx->sockfd, &readfds ))
                             coap_read(ctx);