-
Notifications
You must be signed in to change notification settings - Fork 7.6k
WiFiServer doesn't accept start/stop/start #3960
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Status: Stale
Issue is stale stage (outdated/stuck)
Comments
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions. |
[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions. |
me-no-dev
pushed a commit
that referenced
this issue
Nov 6, 2020
See #3960 for more details of the problem and the solution. I only implemented what was proposed in this ticket, as it solves my problem, which was the same as in this ticket. Credits for the code going to @etrinh ;-) This also is a more consistence behaviour compared to esp8266, where it also is possible to restart the wifiserver immediately on the same port.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
The text was updated successfully, but these errors were encountered: