Skip to content

Commit

Permalink
Updating _port to really used port and made _port accessible (#7003)
Browse files Browse the repository at this point in the history
* Updating _port to really used port and made _port accessible

* 2. Try
  • Loading branch information
LaborEtArs authored and devyte committed Jan 9, 2020
1 parent b4d2ab1 commit 5e537e5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
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

0 comments on commit 5e537e5

Please sign in to comment.