espconn_disconnect doesn't always work
Posted:
Fri Jan 02, 2015 10:29 pm
by RogerClark
Hi,
I'm not sure if espconn_disconnect always works. I have a callback setup for disconnect, but I don't get it every time that I call espconn_disconnect()
So either disconnect is not working, or the callback system is not working
Has anyone else experienced this ?
Re: espconn_disconnect doesn't always work
Posted:
Sat Jan 03, 2015 5:26 pm
by RogerClark
Update.
I think the issue is that the disconnect callback doesn't work if the remote connection does the disconnection rather than the ESP8266 doing the disconnection.
I my code, I open a TCP socket to port 80 on a web server, in order to do a HTTP POST of some data to a web service, however in the POST data, I specify connection: Close which tells the web server to close the connection.
I'm not an expect in TCPIP so I'm not even sure if it is possible for the ESP8266 to determine if the connection has been disconnected by the remote server.
I've searched the web and I can't seem to find much information about TCP socket disconnect callbacks (or notifications), so perhaps this isn't technically possible with TCP.
Re: espconn_disconnect doesn't always work
Posted:
Sun Jan 04, 2015 1:16 am
by Athena
Maybe it is in reconnect callback ?
Re: espconn_disconnect doesn't always work
Posted:
Sun Jan 04, 2015 2:32 am
by RogerClark
@Athena
Thanks.
I will add the reconnect callback and see if that is called instead
I have seen one time that the disconnect callback was received, but I don't know what was different at that time, normally I do get the disconnect callback