Skip to content

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

Closed
etrinh opened this issue May 3, 2020 · 3 comments
Closed

WiFiServer doesn't accept start/stop/start #3960

etrinh opened this issue May 3, 2020 · 3 comments
Labels
Status: Stale Issue is stale stage (outdated/stuck)

Comments

@etrinh
Copy link

etrinh commented May 3, 2020

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

@stale
Copy link

stale bot commented Jul 2, 2020

[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 stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Jul 2, 2020
@stale
Copy link

stale bot commented Jul 16, 2020

[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions.

@everslick
Copy link
Contributor

#1267

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
Labels
Status: Stale Issue is stale stage (outdated/stuck)
Projects
None yet
Development

No branches or pull requests

2 participants