Skip to content

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

Closed
@etrinh

Description

@etrinh

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: StaleIssue is stale stage (outdated/stuck)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions