network-programmingtoit

How can I get the current IP address from the local network?


I would like to know the IP address of the ESP32 the program is running on.

How do I do that?


Solution

  • The IP address comes from an opened network.

    Say we use the default network (WiFi), then the code is as follows:

    import net
    
    main:
      network := net.open
      print network.address
      network.close