diff --git a/class/ec20/at_socket_ec20.c b/class/ec20/at_socket_ec20.c index a6459b9..83ef66c 100644 --- a/class/ec20/at_socket_ec20.c +++ b/class/ec20/at_socket_ec20.c @@ -836,8 +836,8 @@ static void urc_recv_func(struct at_client *client, const char *data, rt_size_t /* get the current socket and receive buffer size by receive data */ sscanf(data, "+QIURC: \"recv\",%d,%d", &device_socket, (int *) &bfsz); - /* get receive timeout by receive buffer length */ - timeout = bfsz; + /* set receive timeout by receive buffer length, not less than 10 ms */ + timeout = bfsz > 10 ? bfsz : 10; if (device_socket < 0 || bfsz == 0) { diff --git a/class/esp8266/at_socket_esp8266.c b/class/esp8266/at_socket_esp8266.c index f82acdd..71ebd9d 100644 --- a/class/esp8266/at_socket_esp8266.c +++ b/class/esp8266/at_socket_esp8266.c @@ -480,8 +480,8 @@ static void urc_recv_func(struct at_client *client, const char *data, rt_size_t /* get the at deveice socket and receive buffer size by receive data */ sscanf(data, "+IPD,%d,%d:", &device_socket, (int *) &bfsz); - /* get receive timeout by receive buffer length */ - timeout = bfsz; + /* set receive timeout by receive buffer length, not less than 10ms */ + timeout = bfsz > 10 ? bfsz : 10; if (device_socket < 0 || bfsz == 0) return; diff --git a/class/m26/at_socket_m26.c b/class/m26/at_socket_m26.c index b30e77b..89e5013 100644 --- a/class/m26/at_socket_m26.c +++ b/class/m26/at_socket_m26.c @@ -608,8 +608,8 @@ static void urc_recv_func(struct at_client *client, const char *data, rt_size_t /* get the current socket and receive buffer size by receive data */ sscanf(data, "+RECEIVE: %d, %d", &device_socket, (int *) &bfsz); - /* get receive timeout by receive buffer length */ - timeout = bfsz; + /* set receive timeout by receive buffer length, not less than 10 ms */ + timeout = bfsz > 10 ? bfsz : 10; if (device_socket < 0 || bfsz == 0) { diff --git a/class/mw31/at_socket_mw31.c b/class/mw31/at_socket_mw31.c index 218feea..ffdb71c 100644 --- a/class/mw31/at_socket_mw31.c +++ b/class/mw31/at_socket_mw31.c @@ -400,8 +400,8 @@ static void urc_recv_func(struct at_client *client, const char *data, rt_size_t sscanf(temp, "%ld,", &bfsz); LOG_D("socket:%d, size:%ld\n", device_socket, bfsz); - /* get receive timeout by receive buffer length */ - timeout = bfsz; + /* set receive timeout by receive buffer length, not less than 10 ms */ + timeout = bfsz > 10 ? bfsz : 10; if (device_socket < 0 || bfsz == 0) return; diff --git a/class/rw007/at_socket_rw007.c b/class/rw007/at_socket_rw007.c index 9362d12..2f6a20b 100644 --- a/class/rw007/at_socket_rw007.c +++ b/class/rw007/at_socket_rw007.c @@ -479,8 +479,8 @@ static void urc_recv_func(struct at_client *client, const char *data, rt_size_t /* get the current socket and receive buffer size by receive data */ sscanf(data, "+IPD,%d,%d:", &device_socket, (int *) &bfsz); - /* get receive timeout by receive buffer length */ - timeout = bfsz; + /* set receive timeout by receive buffer length, not less than 10 ms */ + timeout = bfsz > 10 ? bfsz : 10; if (device_socket < 0 || bfsz == 0) { diff --git a/class/sim800c/at_socket_sim800c.c b/class/sim800c/at_socket_sim800c.c index 036c706..48cf9ce 100644 --- a/class/sim800c/at_socket_sim800c.c +++ b/class/sim800c/at_socket_sim800c.c @@ -557,8 +557,8 @@ static void urc_recv_func(struct at_client *client, const char *data, rt_size_t /* get the current socket and receive buffer size by receive data */ sscanf(data, "+RECEIVE,%d,%d:", &device_socket, (int *) &bfsz); - /* get receive timeout by receive buffer length */ - timeout = bfsz; + /* set receive timeout by receive buffer length, not less than 10 ms */ + timeout = bfsz > 10 ? bfsz : 10; if (device_socket < 0 || bfsz == 0) {