can esp8266 sdk add keepalive get status interface?

grantgao
Posts: 36
Joined: Tue Apr 14, 2015 5:20 pm

can esp8266 sdk add keepalive get status interface?

Postby grantgao » Fri Apr 17, 2015 5:24 pm

i enabled the keepalive in my tcp socket,and it can send and receive keepalive packt will local server ,but i power off my local server suddenly to test what can the esp8266 note me in this case,and result is nothing ! so i am thinking ,why keepalive do nothing in this case? LWIP stack sure know what happened at this time ,can you add a callback interface into sdk for us ?

ESP_Faye
Posts: 1646
Joined: Mon Oct 27, 2014 11:08 am

Re: can esp8266 sdk add keepalive get status interface?

Postby ESP_Faye » Fri Apr 17, 2015 5:33 pm

Hi,

call espconn_regist_reconcb to register a reconnect callback, when TCP connection broke and retry fail, it goes into the reconnect callback.

Thanks for your interest in ESP8266 .

grantgao
Posts: 36
Joined: Tue Apr 14, 2015 5:20 pm

Re: can esp8266 sdk add keepalive get status interface?

Postby grantgao » Fri Apr 17, 2015 5:54 pm

Espressif_Faye wrote:Hi,

call espconn_regist_reconcb to register a reconnect callback, when TCP connection broke and retry fail, it goes into the reconnect callback.

Thanks for your interest in ESP8266 .


i know what you said,and i also implemented the callback like this "espconn_regist_reconcb(user_contype.pCon, we_link_reconn_cb);"
it sure can reconnect when TCP connection broken. but i mean the otherwise,you can test as follow step:
1.boot esp8266 and wait it connect with local TCP server successful
2.plug out Ethernet wire(RJ45 on you PC)
now ,you can see esp8266 report nothing and won't enter "espconn_regist_reconcb" also

grantgao
Posts: 36
Joined: Tue Apr 14, 2015 5:20 pm

Re: can esp8266 sdk add keepalive get status interface?

Postby grantgao » Fri Apr 17, 2015 5:59 pm

E文不好,还是用中文描述一遍吧,就是ESP8266------路由器------本地PC(TCP SERVER),其中路由器和PC是网线连接的,8266作为TCP client连上tcp server以后,如果此时拔掉PC端的网线,8266并无任何反应。如果有keepalive的话,底层的协议栈肯定知道这时候keepalive是收不到回应包的,从而可以通知用户程序,所以我才想到能否在sdk增加这样一个callback接口。

ESP_Faye
Posts: 1646
Joined: Mon Oct 27, 2014 11:08 am

Re: can esp8266 sdk add keepalive get status interface?

Postby ESP_Faye » Mon Apr 20, 2015 2:41 pm

您好,

麻烦调用 espconn_set_opt 设置 enable TCP keepalive

调用 espconn_regist_reconcb 注册 reconnect callback

当连接断开后,等待几分钟,底层 retry 失败后会进入 reconnect callback

Who is online

Users browsing this forum: No registered users and 42 guests