Skip to content

Commit 8765da2

Browse files
LuchoBecerradevyte
authored andcommitted
Added WifiServer::begin(uint16_t port) method, listening port can be changed at runtime (#4123)
1 parent 2c8b2b9 commit 8765da2

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

libraries/ESP8266WiFi/src/WiFiServer.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,12 @@ WiFiServer::WiFiServer(uint16_t port)
5656
}
5757

5858
void WiFiServer::begin() {
59+
begin(_port);
60+
}
61+
62+
void WiFiServer::begin(uint16_t port) {
5963
close();
64+
_port = port;
6065
err_t err;
6166
tcp_pcb* pcb = tcp_new();
6267
if (!pcb)

libraries/ESP8266WiFi/src/WiFiServer.h

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class WiFiServer : public Server {
5151
WiFiClient available(uint8_t* status = NULL);
5252
bool hasClient();
5353
void begin();
54+
void begin(uint16_t port);
5455
void setNoDelay(bool nodelay);
5556
bool getNoDelay();
5657
virtual size_t write(uint8_t);

0 commit comments

Comments
 (0)