Http client to custom port

__vnv__
Posts: 17
Joined: Sat Feb 16, 2019 9:42 pm

Http client to custom port

Postby __vnv__ » Mon Apr 15, 2019 2:02 pm

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
};

Who is online

Users browsing this forum: Baidu [Spider] and 224 guests