Chat freely about anything...

User avatar
By Athena
#6311 espconn_disconnect ,if succeed,enter disconnect callback;if fail,enter reconnect callback.

If every process goes fine, enter the correspondence callback , for example, connect succeed ,enter connected callback;
If anything goes wrong, it will enter the reconnect callback..
User avatar
By soccou
#6495 I am not sure if I am doing something wrong or not.

I am getting vary random behavior with the TCP reconnect callback. I am trying to do a very simple HTTP POST to a webserver.

Most often on the ESP8266 the function defined for espconn_regist_reconcb fires with the message:
"Connection error: -11 - Not connected" and espconn_regist_recvcb function does not execute. I also don't see any return data.
but then again randomly sometimes it does with no changes in the code.

The odd part is I have control of the webserver and I can see that the POST was recieved on the remote end with no problems.

Is there some kind of TCP timeout delay that is firing the reconnect callback function or something else prematurely closing the TCP connection?

Any suggestions welcome.

Sokkou
User avatar
By soccou
#6755
soccou wrote:I am not sure if I am doing something wrong or not.

I am getting vary random behavior with the TCP reconnect callback. I am trying to do a very simple HTTP POST to a webserver.

Most often on the ESP8266 the function defined for espconn_regist_reconcb fires with the message:
"Connection error: -11 - Not connected" and espconn_regist_recvcb function does not execute. I also don't see any return data.
but then again randomly sometimes it does with no changes in the code.

The odd part is I have control of the webserver and I can see that the POST was recieved on the remote end with no problems.

Is there some kind of TCP timeout delay that is firing the reconnect callback function or something else prematurely closing the TCP connection?

Any suggestions welcome.

Sokkou


Answering my own question. I think it was some kind of timeout due to not sending data fast enough after the connection was opened. I had opened the connection then calculated some values from a ds18b20. If I did the sensor read first, it seems to have helped the problem.
User avatar
By Athena
#7053 There is a "server timeout", means server will disconnect client which doesn't communicate with it。

ESP8266 as TCP server will also disconnect to tcp client which didn't communicate with it for a while。

espconn_regist_time to set this timeout,7200 seconds at most. If the tcp client didn't send any message to ESP8266 which as TCP server till timeout, ESP8266 will disconnect to the client.