i would like to establish a tcp connection which doesn't get closed after the first data send, i read about the espconn_set_keepalive function which sends heartbeats to the server so it doesn't disconnect (if i understood correctly). But i don't know when i should call the function? In the connectcb?
I tried it like this:
Code: Select all
LOCAL void ICACHE_FLASH_ATTR
tcp_connect_cb(void *arg){
os_printf("We are connected!\n");
sint8 ret = espconn_set_keepalive((struct espconn*)arg,ESPCONN_KEEPCNT,(void*)1000);
if(ret==0)
os_printf("Set keepalive.\n");
}
But the text didn't get printed on my serial terminal. What did I do wrong?
Any help is very much appreciated!