i am using two esp32's . In the first one i have set the host name as below in wifi event handler below SYSTEM_EVENT_STA_START
ESP_ERROR_CHECK(tcpip_adapter_set_hostname(TCPIP_ADAPTER_IF_STA, "testing32"));
I am able to ping this using
ping testing32 on my windows pc and i am getting reply from the router.
However when i am using the gethostbyname i am not able to retrieve the ip.
here is the snippet
Code: Select all
struct hostent *hp;
struct in_addr **addr;
hp = gethostbyname("testing32");
if(hp == NULL){
ESP_LOGI(TAG,"Cannot resolve host ");
}
Could anyone let me know other ways to resolve this .