From a51ef1c41fdf5593095d4af82af82fefdce8af4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B6=82=E7=85=9C=E6=B4=8B?= <1163589503@qq.com> Date: Tue, 8 Aug 2023 11:06:34 +0800 Subject: [PATCH] Fix edu-arm32 UDPSend bug. --- .../XiZi_IIoT/resources/ethernet/cmd_lwip/lwip_udp_demo.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Ubiquitous/XiZi_IIoT/resources/ethernet/cmd_lwip/lwip_udp_demo.c b/Ubiquitous/XiZi_IIoT/resources/ethernet/cmd_lwip/lwip_udp_demo.c index 0456aa419..71c6bc703 100755 --- a/Ubiquitous/XiZi_IIoT/resources/ethernet/cmd_lwip/lwip_udp_demo.c +++ b/Ubiquitous/XiZi_IIoT/resources/ethernet/cmd_lwip/lwip_udp_demo.c @@ -20,10 +20,10 @@ #include "board.h" #include "sys_arch.h" #include "lwip/udp.h" -#include "lwip/sockets.h" #include #include #include +#include "lwip/sockets.h" #define PBUF_SIZE 27 @@ -102,8 +102,8 @@ void *LwipUdpSendTest(int argc, char *argv[]) udp_interval = 100; } else { strncpy(udp_demo_msg, argv[1], strlen(argv[1])); - strncat(udp_demo_msg, "\r\n", 2); - if(argc == 3) { + strncat(udp_demo_msg, "\r\n", 3); + if(argc >= 3) { sscanf(argv[2], "%d.%d.%d.%d:%d", &udp_server_ip[0], &udp_server_ip[1], &udp_server_ip[2], &udp_server_ip[3], &udp_server_port); } if(argc > 3) { @@ -119,7 +119,7 @@ void *LwipUdpSendTest(int argc, char *argv[]) sys_thread_new("udp send", LwipUDPSendTask, NULL, LWIP_TASK_STACK_SIZE, LWIP_DEMO_TASK_PRIO); } -SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0) | SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN) | SHELL_CMD_PARAM_NUM(3), +SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0) | SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN) | SHELL_CMD_PARAM_NUM(5), UDPSend, LwipUdpSendTest, UDPSend msg [ip:port [num [interval]]]); void LwipUdpRecvTest(void)