Skip to content

WiFiServer - method end() added #347

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/WiFiServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,21 @@ uint8_t WiFiServer::begin(uint8_t opt)
return 1;
}

void WiFiServer::end()
{
if (_socket != -1) {
for (SOCKET s = 0; s < TCP_SOCK_MAX; s++) {
if (WiFiSocket.hasParent(_socket, s)) {
WiFiSocket.close(s);
}
}
if (WiFiSocket.listening(_socket)) {
WiFiSocket.close(_socket);
_socket = -1;
}
}
}

WiFiClient WiFiServer::available(uint8_t* status)
{
if (status != NULL) {
Expand Down
1 change: 1 addition & 0 deletions src/WiFiServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class WiFiServer : public Server {
WiFiClient available(uint8_t* status = NULL);
void begin();
uint8_t beginSSL();
void end();
virtual size_t write(uint8_t);
virtual size_t write(const uint8_t *buf, size_t size);
uint8_t status();
Expand Down