tcpTest continued

This commit is contained in:
Wolfgang Hottgenroth 2020-11-11 14:50:48 +01:00
parent 118228fec1
commit d97c08f859
Signed by: wn
GPG Key ID: 6C1E5E531E0D5D7F

View File

@ -33,17 +33,36 @@ void tcpTestHandler(void *handle) {
if (res == TCPTEST_SOCK) {
coloredMsg(LOG_YELLOW, "tth, socket is initialized");
state = 1;
} else {
state = 255;
}
break;
case 1:
coloredMsg(LOG_YELLOW, "tth, connecting");
res = connect(TCPTEST_SOCK, remoteAddr, remotePort);
coloredMsg(LOG_YELLOW, "tth, connect returns %d", res);
state = 255;
if (res == SOCK_BUSY) {
coloredMsg(LOG_YELLOW, "tth, ok, waiting for established");
state = 2;
} else {
state = 255;
}
break;
case 2:
coloredMsg(LOG_YELLOW, "tth, waiting for established");
uint8_t sockState = getSn_SR(TCPTEST_SOCK);
coloredMsg(LOG_YELLOW, "tth, socket state is %d", sockState);
if (sockState == SOCK_ESTABLISHED) {
coloredMsg(LOG_YELLOW, "tth, connection is established");
state = 255;
}
case 255:
coloredMsg(LOG_YELLOW, "tth, error state, will stop here");
schDel(tcpTestHandler, NULL);