ESP8266 Developer Zone The Official ESP8266 Forum 2015-11-02T11:16:27+08:00 https://bbs.espressif.com:443/feed.php?f=7&t=1290 2015-11-02T11:16:27+08:00 2015-11-02T11:16:27+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1290&p=4407#p4407 <![CDATA[Re: How to correctly stop a TCP server from listening?]]>
Thanks for your valuable advice ! We will add it in the documentation.

1. espconn_get_connection_info can get the information of connections, here is an example in tcp_server_mutli_sent http://bbs.espressif.com/viewtopic.php?f=31&t=763.

2. espconn_tcp_set_max_con_allow can set the maximum number of TCP clients that allowed to connect to the server.

Thanks for your interest in ESP8266 !

Statistics: Posted by ESP_Faye — Mon Nov 02, 2015 11:16 am


]]>
2015-10-30T12:35:57+08:00 2015-10-30T12:35:57+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1290&p=4378#p4378 <![CDATA[Re: How to correctly stop a TCP server from listening?]]>
It now begs some new questions:

1) For a given socket listener, is there a way to determine which client connections are "associated" with that listener? It seems in order to close the socket listener, I need to close clients that were created when they connected to that server port ... am I supposed to track those myself?

2) What if I wish to suspend the arrival of new server connection requests while I process the clients I already have? I had assumed that I could "stop" a TCP server for listening when I had accumulated my limit of client connections. Since I don't seem to be able to do this without first closing the previous client connections that I am not yet finished with, I appear to be at an impass.

Statistics: Posted by kolban — Fri Oct 30, 2015 12:35 pm


]]>
2015-10-30T12:12:10+08:00 2015-10-30T12:12:10+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1290&p=4377#p4377 <![CDATA[Re: How to correctly stop a TCP server from listening?]]>
Returning code of -5 (ESPCONN_INPROGRESS) means that there are still TCP clients connected to TCP server.

You could call espconn_disconnect to disconnect the clients first, then call espconn_delete to delete the server.

Thanks for your interest in ESP8266 !

Statistics: Posted by ESP_Faye — Fri Oct 30, 2015 12:12 pm


]]>
2015-10-27T12:05:30+08:00 2015-10-27T12:05:30+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1290&p=4297#p4297 <![CDATA[How to correctly stop a TCP server from listening?]]>
What API should I use to stop the socket from listening any further?

I thought maybe that it might have been espconn_delete(), however when I call that, I get a return code of -5 (ESPCONN_INPROGRESS) and the socket is still listening for new connections.

Statistics: Posted by kolban — Tue Oct 27, 2015 12:05 pm


]]>