From 9c1bc47033a07c0dc75b7c19f9175083601daf72 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Wed, 11 Nov 2020 18:41:16 +0100 Subject: [PATCH] tcpTest continued --- cube/User/Src/tcpTest.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cube/User/Src/tcpTest.c b/cube/User/Src/tcpTest.c index e32b618..bd51a9d 100644 --- a/cube/User/Src/tcpTest.c +++ b/cube/User/Src/tcpTest.c @@ -20,6 +20,7 @@ uint16_t remotePort = 5000; void tcpTestHandler(void *handle) { static uint8_t state = 0; int8_t res = 0; + int16_t res16 = 0; int32_t res32 = 0; static uint8_t message[] = "Hello world\n\r"; @@ -77,12 +78,12 @@ void tcpTestHandler(void *handle) { case 4: // coloredMsg(LOG_YELLOW, "tth, now waiting for some input"); - uint16_t s = getSn_RX_RSR(TCPTEST_SOCK); - // coloredMsg(LOG_YELLOW, "tth, getSn_RxMAX returns %d", s); + res16 = getSn_RX_RSR(TCPTEST_SOCK); + // coloredMsg(LOG_YELLOW, "tth, getSn_RxMAX returns %d", res16); - if (s > 0) { - uint8_t *buf = (uint8_t*) malloc(s); - res32 = recv(TCPTEST_SOCK, buf, s); + if (res16 > 0) { + uint8_t *buf = (uint8_t*) malloc(res16); + res32 = recv(TCPTEST_SOCK, buf, res16); coloredMsg(LOG_YELLOW, "tth, recv returns 0x%02x", res32); if (res32 > 0) { coloredMsg(LOG_YELLOW, "tth, received: %s", buf);