Skip to content
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

Updating _port to really used port and made _port accessible #7003

Merged
merged 2 commits into from
Jan 9, 2020
Merged
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
5 changes: 5 additions & 0 deletions libraries/ESP8266WiFi/src/WiFiServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ void WiFiServer::begin(uint16_t port) {
return;
}
_pcb = listen_pcb;
_port = _pcb->local_port;
tcp_accept(listen_pcb, &WiFiServer::_s_accept);
tcp_arg(listen_pcb, (void*) this);
}
Expand Down Expand Up @@ -126,6 +127,10 @@ uint8_t WiFiServer::status() {
return _pcb->state;
}

uint16_t WiFiServer::port() const {
return _port;
}

void WiFiServer::close() {
if (!_pcb) {
return;
Expand Down
1 change: 1 addition & 0 deletions libraries/ESP8266WiFi/src/WiFiServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class WiFiServer : public Server {
virtual size_t write(uint8_t);
virtual size_t write(const uint8_t *buf, size_t size);
uint8_t status();
uint16_t port() const;
void close();
void stop();

Expand Down