Skip to content

Commit 5f94a60

Browse files
authored
Changed / added virtual functions for returning connection information (#8693)
Fixes the incorrect behavior of WiFiClientSecure.remoteIP(), .remotePort(), .localIP(), .localPort().
1 parent d3eddeb commit 5f94a60

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

Diff for: libraries/ESP8266WiFi/src/WiFiClient.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ class WiFiClient : public Client, public SList<WiFiClient> {
9191
virtual uint8_t connected() override;
9292
virtual operator bool() override;
9393

94-
IPAddress remoteIP();
95-
uint16_t remotePort();
96-
IPAddress localIP();
97-
uint16_t localPort();
94+
virtual IPAddress remoteIP();
95+
virtual uint16_t remotePort();
96+
virtual IPAddress localIP();
97+
virtual uint16_t localPort();
9898

9999
static void setLocalPortStart(uint16_t port) { _localPort = port; }
100100

Diff for: libraries/ESP8266WiFi/src/WiFiClientSecureBearSSL.h

+5
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,11 @@ class WiFiClientSecure : public WiFiClient {
278278
void flush() override { (void)flush(0); }
279279
void stop() override { (void)stop(0); }
280280

281+
IPAddress remoteIP() override { return _ctx->remoteIP(); }
282+
uint16_t remotePort() override { return _ctx->remotePort(); }
283+
IPAddress localIP() override { return _ctx->localIP(); }
284+
uint16_t localPort() override { return _ctx->localPort(); }
285+
281286
// Allow sessions to be saved/restored automatically to a memory area
282287
void setSession(Session *session) { _ctx->setSession(session); }
283288

0 commit comments

Comments
 (0)