http_get example: fix compilation with ipv6 disabled.
This commit is contained in:
parent
0d5e3bb663
commit
87994d3bb4
1 changed files with 4 additions and 0 deletions
|
@ -48,6 +48,7 @@ void http_get_task(void *pvParameters)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if LWIP_IPV6
|
||||||
{
|
{
|
||||||
struct netif *netif = sdk_system_get_netif(0);
|
struct netif *netif = sdk_system_get_netif(0);
|
||||||
int i;
|
int i;
|
||||||
|
@ -57,14 +58,17 @@ void http_get_task(void *pvParameters)
|
||||||
printf(" ip6 addr %d = %s\n", i, ip6addr_ntoa(netif_ip6_addr(netif, i)));
|
printf(" ip6 addr %d = %s\n", i, ip6addr_ntoa(netif_ip6_addr(netif, i)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
struct sockaddr *sa = res->ai_addr;
|
struct sockaddr *sa = res->ai_addr;
|
||||||
if (sa->sa_family == AF_INET) {
|
if (sa->sa_family == AF_INET) {
|
||||||
printf("DNS lookup succeeded. IP=%s\r\n", inet_ntoa(((struct sockaddr_in *)sa)->sin_addr));
|
printf("DNS lookup succeeded. IP=%s\r\n", inet_ntoa(((struct sockaddr_in *)sa)->sin_addr));
|
||||||
}
|
}
|
||||||
|
#if LWIP_IPV6
|
||||||
if (sa->sa_family == AF_INET6) {
|
if (sa->sa_family == AF_INET6) {
|
||||||
printf("DNS lookup succeeded. IP=%s\r\n", inet6_ntoa(((struct sockaddr_in6 *)sa)->sin6_addr));
|
printf("DNS lookup succeeded. IP=%s\r\n", inet6_ntoa(((struct sockaddr_in6 *)sa)->sin6_addr));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int s = socket(res->ai_family, res->ai_socktype, 0);
|
int s = socket(res->ai_family, res->ai_socktype, 0);
|
||||||
if(s < 0) {
|
if(s < 0) {
|
||||||
|
|
Loading…
Reference in a new issue