[Resolved] espconn disconnect callback not received

esp03madness
Posts: 8
Joined: Tue Nov 24, 2015 11:42 am

[Resolved] espconn disconnect callback not received

Postby esp03madness » Sun Jan 10, 2016 11:38 pm

Hello friends,

I having some problems using espconn with RTOS SDK 1.3. I am able to open a TCP connection as a client - connect, receive data, stay idle. When remote closes connection (due to timeout), I do not get a disconnection callback.

Code: Select all

//create tcp connection like this
...
connection.type=ESPCONN_TCP;
connection.state=ESPCONN_NONE;
connection.proto.tcp=&tcp;
tcp.local_port = espconn_port();
tcp.remote_port = 1234;
memcpy(&tcp.remote_ip, &ip, 4);
espconn_regist_connectcb(&connection, network_connected_cb);         //called
espconn_regist_disconcb(&connection, network_disconnected_cb);       //not called
espconn_regist_reconcb(&connection, network_reconnected_cb);         //not called
espconn_regist_recvcb(&connection, network_receive_cb);              //called

espconn_connect(&connection);


Here's what I see in the console

Code: Select all

...
espconn_client_connect, regist espconn_client_recv
network_connected_cb
network_receive_cb
RX: blah blah blah
//*** some time passes, remote closes connection due to inactivity ***
espconn_client_recv, espconn_client_close, err:0, p:      0
espconn_client_close, close
//*** network_disconnected_cb should be here, but it isn't ***

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

Re: espconn disconnect callback not received

Postby ESP_Faye » Mon Jan 11, 2016 2:20 pm

Hi,

Please call "espconn_init();" in the user_init. And try it again.

If your problem is still unsolved, please feel free to let us know.

Thanks for your interest in ESP8266 !

esp03madness
Posts: 8
Joined: Tue Nov 24, 2015 11:42 am

Re: espconn disconnect callback not received

Postby esp03madness » Mon Jan 11, 2016 5:35 pm

That worked, thank you.

Why is espconn_init() not part of the espconn.h header file?

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

Re: [Resolved] espconn disconnect callback not received

Postby ESP_Faye » Tue Jan 12, 2016 10:34 am

Hi,

Sorry that we missed it in the espconn.h. It will be added in the next RTOS SDK.

Sorry for the inconvenience.

Who is online

Users browsing this forum: No registered users and 193 guests