Merge pull request #688 from strongly-typed/feature/http_get_host

http_get example: Make compatible with IPv4
This commit is contained in:
Ruslan V. Uss 2018-12-04 20:31:00 +05:00 committed by GitHub
commit a721fb0bc7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,9 +21,9 @@
#include "ssid_config.h" #include "ssid_config.h"
#define WEB_SERVER "ipv6.google.com" #define WEB_SERVER "httpbin.org"
#define WEB_PORT 80 #define WEB_PORT "80"
#define WEB_PATH "/" #define WEB_PATH "/get"
void http_get_task(void *pvParameters) void http_get_task(void *pvParameters)
{ {
@ -38,7 +38,7 @@ void http_get_task(void *pvParameters)
struct addrinfo *res; struct addrinfo *res;
printf("Running DNS lookup for %s...\r\n", WEB_SERVER); printf("Running DNS lookup for %s...\r\n", WEB_SERVER);
int err = getaddrinfo(WEB_SERVER, "80", &hints, &res); int err = getaddrinfo(WEB_SERVER, WEB_PORT, &hints, &res);
if (err != 0 || res == NULL) { if (err != 0 || res == NULL) {
printf("DNS lookup failed err=%d res=%p\r\n", err, res); printf("DNS lookup failed err=%d res=%p\r\n", err, res);