tcpTest continued

This commit is contained in:
Wolfgang Hottgenroth 2020-11-11 18:41:16 +01:00
parent c7c0cc12b4
commit 9c1bc47033
Signed by: wn
GPG Key ID: 6C1E5E531E0D5D7F

View File

@ -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);