I have started working on esp_http_server and I used "restful_server" example as starting point. So far so good.
I would like to know the IP of the client connecting to the esp_http_server (esp32 is NOT in softAP).
I see that in "components/esp_http_server/src/httpd_main" the function "httpd_accept_conn" accepts the incoming connection and I guess that the IP is retrieve.
Code: Select all
struct sockaddr_in addr_from;
socklen_t addr_from_len = sizeof(addr_from);
int new_fd = accept(listen_fd, (struct sockaddr *)&addr_from, &addr_from_len);
if (new_fd < 0) {
ESP_LOGW(TAG, LOG_FMT("error in accept (%d)"), errno);
return ESP_FAIL;
}
I'm using commit 9c6bec2 for esp_http_server component.
Thanks