From 6a02a5834734f62616df6d6401d86428cfbac417 Mon Sep 17 00:00:00 2001 From: zhangjunhao Date: Wed, 15 Nov 2017 11:58:19 +0800 Subject: [PATCH] fix(tw16355): examples/protocols/coap_client(server) fix coap example can not work properly --- examples/protocols/coap_client/main/coap_client_example_main.c | 2 +- examples/protocols/coap_server/main/coap_server_example_main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/protocols/coap_client/main/coap_client_example_main.c b/examples/protocols/coap_client/main/coap_client_example_main.c index c9d8b22fcd..98f003e1ad 100644 --- a/examples/protocols/coap_client/main/coap_client_example_main.c +++ b/examples/protocols/coap_client/main/coap_client_example_main.c @@ -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); diff --git a/examples/protocols/coap_server/main/coap_server_example_main.c b/examples/protocols/coap_server/main/coap_server_example_main.c index 47f47dfc5d..b3ea703080 100644 --- a/examples/protocols/coap_server/main/coap_server_example_main.c +++ b/examples/protocols/coap_server/main/coap_server_example_main.c @@ -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); -- 2.40.0