From 6374890a7207701473214540b1857ba4b89f3d05 Mon Sep 17 00:00:00 2001 From: David Lin Date: Sat, 7 Mar 2020 08:34:30 +0800 Subject: [PATCH] Fixed bug of tcp receive int tos_sal_module_recv_timeout(int sock, void *buf, size_t len, uint32_t timeout); This 'len' is data buffer length. --- board/STM32F103_SIM800A/Src/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/board/STM32F103_SIM800A/Src/main.c b/board/STM32F103_SIM800A/Src/main.c index 786e4b09..150a7f40 100644 --- a/board/STM32F103_SIM800A/Src/main.c +++ b/board/STM32F103_SIM800A/Src/main.c @@ -32,7 +32,7 @@ void tcp_test1(void) while (1) { tos_sal_module_send(socket_id, (const unsigned char*)data_send, strlen(data_send)); - ret = tos_sal_module_recv_timeout(socket_id, recv_data1, strlen(data_send), 8000); + ret = tos_sal_module_recv_timeout(socket_id, recv_data1, sizeof(recv_data1), 8000); if (ret < 0) { printf("recv error\n\r"); } else { @@ -52,7 +52,7 @@ void tcp_test2(void) while (1) { tos_sal_module_send(socket_id2, (const unsigned char*)data_send2, strlen(data_send2)); - ret = tos_sal_module_recv_timeout(socket_id2, recv_data2, strlen(data_send2), 8000); + ret = tos_sal_module_recv_timeout(socket_id2, recv_data2, sizeof(recv_data2), 8000); if (ret < 0) { printf("recv2 error\n\r"); } else {