Page 1 of 1

Http client to custom port

Posted: Mon Apr 15, 2019 2:02 pm
by __vnv__
Hello everyone,


I want to connect to custom web port http://x.y.z.q:8000/myapi but it seems that http client doesn't want to do that.

Could someone please help out on this, I have tried following


VERSION 1. (Doesn't work)

esp_http_client_config_t config = {
.url = "http://192.168.1.100:8000/api/getdata",
.event_handler = _http_event_handler,
.buffer_size = 10240
};

VERSION 2. (Doesn't work)

esp_http_client_config_t config = {
.url = "",
.host = "192.168.1.100",
.path = "/api/getdata",
.port = 8000,
.event_handler = _http_event_handler,
.buffer_size = 10240
};


VERSION 3. (Doesn't work, throws exception because url cannot be NULL)

esp_http_client_config_t config = {
.host = "192.168.1.100",
.path = "/api/getdata",
.port = 8000,
.event_handler = _http_event_handler,
.buffer_size = 10240
};