Another easy solution for this problem is to close server_socket(listen_sock) when we are closing the client socket(sock).
Add the highlighted line into tcp_server_task() function.
if (sock != -1) {
ESP_LOGE(TAG, "Shutting down socket and restarting...");
shutdown(sock, 0);
close(sock ...
Search found 2 matches
- Fri Nov 16, 2018 7:28 pm
- Forum: General Discussion
- Topic: tcp_server example not able to reconnect the server after disconnect
- Replies: 25
- Views: 39383
- Tue Nov 06, 2018 7:29 pm
- Forum: General Discussion
- Topic: tcp_server example not able to reconnect the server after disconnect
- Replies: 25
- Views: 39383
Re: tcp_server example not able to reconnect the server after disconnect
attached full code for TCP SERVER + SOFTAP + STA with bugfix of connection problems after disconnect and connect again.
+ fix with able to resume socket even after disconnecting and connecting back to the station or softap.
you can switch between station and softap by changing rf_mode value.
rf ...
+ fix with able to resume socket even after disconnecting and connecting back to the station or softap.
you can switch between station and softap by changing rf_mode value.
rf ...