Page 1 of 1

setting PING_TARGET_IP_ADDRESS with ip4_addr_t

Posted: Sat Apr 27, 2019 12:19 am
by timboesp
I've been working with the only ping example I can find, which uses the gateway ip obtained after connecting to AP for target ip ping. I want to ping a specific IP or URL, such as "www.microsoft.com" or 23.46.201.6.

Can someone offer an example snippet to set the ip4_addr_t struct properly?

For example, say I want to ping "www.microsoft.com" or 23.46.201.6 how would I set the struct pingTargetIP below:

ip4_addr_t pingTargetIP ;
...
esp_ping_set_target(PING_TARGET_IP_ADDRESS, &pingTargetIP.addr, sizeof(uint32_t));
...

I've tried to use IP4_ADDR() but that macro is incompatible.

ESP-IDF v3.3-beta2-60-g86c9b6354-dirty
HW: ESP32 DevKitV1
Kunbutu

Thanks

Re: setting PING_TARGET_IP_ADDRESS with ip4_addr_t

Posted: Sat Apr 27, 2019 7:27 am
by WiFive
ipaddr_addr("23.46.201.6")

Re: setting PING_TARGET_IP_ADDRESS with ip4_addr_t

Posted: Fri May 03, 2019 5:40 pm
by timboesp
Wifive, thanks that was helpful.