Closed
Description
Hi,
WiFiServer (/WebServer) doesn't allow to stop the service and start it again in a row.
The SO_REUSEADDR is forgotten in WiFiServer to allow to reuse a socket when it was just closed (else we have a long to death timeout...)
Issue seems to have been first noticed in #1267.
Adding:
int enable = 1;
setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(int));
Right after:
sockfd = socket(AF_INET , SOCK_STREAM, 0);
if (sockfd < 0)
return;
Make the wifiserver (/webserver).begin() works just after close().
It is more important to make this work as the WiFiServer (/WebServer) API is damn poor and doesn't provide notification of failure (neither of success/running)... :((((
Thank you