tcpTest continued
This commit is contained in:
parent
118228fec1
commit
d97c08f859
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user