Skip to content

Commit 6a02a58

Browse files
author
zhangjunhao
committedNov 15, 2017
fix(tw16355): examples/protocols/coap_client(server)
fix coap example can not work properly
1 parent ec9d93f commit 6a02a58

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed
 

‎examples/protocols/coap_client/main/coap_client_example_main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ static void coap_example_task(void *p)
139139
FD_ZERO(&readfds);
140140
FD_CLR( ctx->sockfd, &readfds );
141141
FD_SET( ctx->sockfd, &readfds );
142-
result = select( FD_SETSIZE, &readfds, 0, 0, &tv );
142+
result = select( ctx->sockfd+1, &readfds, 0, 0, &tv );
143143
if (result > 0) {
144144
if (FD_ISSET( ctx->sockfd, &readfds ))
145145
coap_read(ctx);

‎examples/protocols/coap_server/main/coap_server_example_main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ static void coap_example_thread(void *p)
120120
FD_CLR( ctx->sockfd, &readfds);
121121
FD_SET( ctx->sockfd, &readfds);
122122

123-
int result = select( FD_SETSIZE, &readfds, 0, 0, &tv );
123+
int result = select( ctx->sockfd+1, &readfds, 0, 0, &tv );
124124
if (result > 0){
125125
if (FD_ISSET( ctx->sockfd, &readfds ))
126126
coap_read(ctx);

0 commit comments

Comments
 (0)
Please sign in to comment.