如何在 ESP8266/ESP32 上获取当前网关 IP 地址
为了在 ESP8266 或 ESP32 上获取当前网关 IP 地址,使用:
get_gateway.cpp
WiFi.gatewayIP();为了在串口上打印网关 IP 地址,使用
get_gateway.cpp
Serial.println("Gateway IP address: ");
Serial.println(WiFi.gatewayIP());为了将网关 IP 地址获取为字符串,使用
get_gateway.cpp
String gatewayIP = WiFi.gatewayIP().toString();Check out similar posts by category:
C/C++, Embedded, ESP8266/ESP32, PlatformIO
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow