setting PING_TARGET_IP_ADDRESS with ip4_addr_t

timboesp
Posts: 18
Joined: Fri Apr 26, 2019 6:24 pm

setting PING_TARGET_IP_ADDRESS with ip4_addr_t

Postby timboesp » Sat Apr 27, 2019 12:19 am

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

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: setting PING_TARGET_IP_ADDRESS with ip4_addr_t

Postby WiFive » Sat Apr 27, 2019 7:27 am

ipaddr_addr("23.46.201.6")

timboesp
Posts: 18
Joined: Fri Apr 26, 2019 6:24 pm

Re: setting PING_TARGET_IP_ADDRESS with ip4_addr_t

Postby timboesp » Fri May 03, 2019 5:40 pm

Wifive, thanks that was helpful.

Who is online

Users browsing this forum: No registered users and 267 guests