diff --git a/src/WiFiUdp.cpp b/src/WiFiUdp.cpp index e55c9656..1ef15e2b 100644 --- a/src/WiFiUdp.cpp +++ b/src/WiFiUdp.cpp @@ -287,3 +287,8 @@ uint16_t WiFiUDP::remotePort() { return _rcvPort; } + +IPAddress WiFiUDP::destinationIP() +{ + return _sndIP; +} diff --git a/src/WiFiUdp.h b/src/WiFiUdp.h index d9616823..2b9dbf13 100644 --- a/src/WiFiUdp.h +++ b/src/WiFiUdp.h @@ -84,6 +84,8 @@ class WiFiUDP : public UDP { // Return the port of the host who sent the current incoming packet virtual uint16_t remotePort(); + // Return the IP address of the destination host. Useful when beginPacket(const char *host, uint16_t port) method is used. + virtual IPAddress destinationIP(); }; #endif /* WIFIUDP_H */