Find IP address of website using Wiced DNS API

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
AnGh_2749951
Level 1
Level 1

Hello,

I want to find IP address of given website, using Wiced DNS API or any other way.

I have CYW943907AEVAL1F Evaluation Kit User Guide.

Could any one please help me in this ?

0 Likes
1 Solution
PriyaM_16
Moderator
Moderator
Moderator
250 replies posted 100 replies posted 50 replies posted

Please refer the httpbin_org snip for example of resolving IP address of a given host.

#define SERVER_HOST        "www.httpbin.org"

wiced_ip_address_t  ip_address;

wiced_hostname_lookup( SERVER_HOST, &ip_address, DNS_TIMEOUT_MS, WICED_STA_INTERFACE );

WPRINT_APP_INFO( ( "%s is at %u.%u.%u.%u\n", SERVER_HOST,

                                                 (uint8_t)(GET_IPV4_ADDRESS(ip_address) >> 24),

                                                 (uint8_t)(GET_IPV4_ADDRESS(ip_address) >> 16),

                                                 (uint8_t)(GET_IPV4_ADDRESS(ip_address) >> 8),

                                                 (uint8_t)(GET_IPV4_ADDRESS(ip_address) >> 0) ) );

View solution in original post

0 Likes
1 Reply
PriyaM_16
Moderator
Moderator
Moderator
250 replies posted 100 replies posted 50 replies posted

Please refer the httpbin_org snip for example of resolving IP address of a given host.

#define SERVER_HOST        "www.httpbin.org"

wiced_ip_address_t  ip_address;

wiced_hostname_lookup( SERVER_HOST, &ip_address, DNS_TIMEOUT_MS, WICED_STA_INTERFACE );

WPRINT_APP_INFO( ( "%s is at %u.%u.%u.%u\n", SERVER_HOST,

                                                 (uint8_t)(GET_IPV4_ADDRESS(ip_address) >> 24),

                                                 (uint8_t)(GET_IPV4_ADDRESS(ip_address) >> 16),

                                                 (uint8_t)(GET_IPV4_ADDRESS(ip_address) >> 8),

                                                 (uint8_t)(GET_IPV4_ADDRESS(ip_address) >> 0) ) );

0 Likes