I have two ESP32s. One is acting as webserver and the other is acting as a client that will send a GET request to the server ESP32. Both of the ESP32s are connected to the same WiFi AP.

For sending the request I need to know the server address, but I don't want to enter it into the code manually.

Is there any way with which I can figure out the IP address of the server ESP32 using the other ESP32?

  • 3
    Have a look into mDNS. I think there are already libraries for this on the ESP32
    – chrisl
    Commented Aug 11, 2022 at 11:51
  • isn't that for esp32 and web browser?
    – Arslan
    Commented Aug 11, 2022 at 11:58
  • What do you mean by that? mDNS is a way to give your device a name without having a dedicated DNS server. That way you can set the name of each device on the device itself. The client can then refer to this name of the device.
    – chrisl
    Commented Aug 11, 2022 at 13:05
  • @chrisl In may case client is another esp32.
    – Arslan
    Commented Aug 12, 2022 at 7:00
  • The other ESP32 also only does web requests, just like a webbrowser. mDNS just helps you to get the current IP address to the predefined name. Lets say Esp1 calls itself service1 and anounces that name through mDNS. Then Esp2 can ask mDNS for the IP address of service1 and then make a web request to that address. There should be examples and tutorials available online
    – chrisl
    Commented Aug 12, 2022 at 8:38


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.