Eric Jung
/
WIZnet-IoTShield-BG96-TCP
BG96 Cat.M1 TCP client sample for WIZnet IoT Shield
Diff: main.cpp
- Revision:
- 3:4041e2cc0f19
- Parent:
- 2:46cc35700e0e
--- a/main.cpp Wed Mar 20 05:31:05 2019 +0000 +++ b/main.cpp Fri Apr 05 07:32:43 2019 +0000 @@ -203,8 +203,8 @@ myprintf("sockOpenConnect: success\r\n"); char sendbuf[] = "Hello Cat.M1\r\n"; - if(sendData_BG96(sendbuf, sizeof(sendbuf))) { - myprintf("dataSend [%d] %s\r\n", sizeof(sendbuf), sendbuf); + if(sendData_BG96(sendbuf, strlen(sendbuf))) { + myprintf("dataSend [%d] %s\r\n", strlen(sendbuf), sendbuf); } } else { @@ -227,6 +227,10 @@ if(recvData_BG96(recvbuf, &recvlen) == RET_OK) { myprintf("dataRecv [%d] %s\r\n", recvlen, recvbuf); + // Loopback: Resend received data to TCP server + sendData_BG96(recvbuf, recvlen); + myprintf("dataSend [%d] %s\r\n", recvlen, recvbuf); + char * ptr = strstr(recvbuf, "exit"); if(ptr != 0) break; }