Eric Jung
/
WIZnet-IoTShield-BG96-TCP
BG96 Cat.M1 TCP client sample for WIZnet IoT Shield
Revision 3:4041e2cc0f19, committed 2019-04-05
- Comitter:
- hkjung
- Date:
- Fri Apr 05 07:32:43 2019 +0000
- Parent:
- 2:46cc35700e0e
- Commit message:
- Added TCP loopback
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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; }