-->
Page 1 of 5

WiFi.hostname doesn work

PostPosted: Fri Jul 28, 2017 8:53 am
by KDB
String host_name="ESP3";

WiFi.hostname(host_name);

Doesn't work ???

Re: WiFi.hostname doesn work

PostPosted: Fri Jul 28, 2017 9:13 am
by martinayotte
What do you mean "not working" ?

Does your router shows that ESP3 hostname in the IP leases list ?

Don't expect to be able to do "ping ESP3", it won't work since the DNS doesn't know this hostname.
Use mDNS service on your ESP, install Bonjour on Windows, and then "ESP3.local" will be resolved.

Re: WiFi.hostname doesn work

PostPosted: Fri Jul 28, 2017 9:55 am
by KDB
martinayotte wrote:What do you mean "not working" ?

Does your router shows that ESP3 hostname in the IP leases list ?

Don't expect to be able to do "ping ESP3", it won't work since the DNS doesn't know this hostname.
Use mDNS service on your ESP, install Bonjour on Windows, and then "ESP3.local" will be resolved.


The router shows other names. Esp Server and the dns name is ESPxxxxxx. xxxxxx is the end of the mac adress

Re: WiFi.hostname doesn work

PostPosted: Fri Jul 28, 2017 2:17 pm
by martinayotte
Are you doing the WiFi.hostname("ESP3") before doing the calls to WiFi.mode(WIFI_STA); and WiFi.begin(ssid, password); ?

For me, it is working fine, notice the name I've choose still contains end of MAC, but this is what I want :

Code: Select allMyESPAP-192B86   192.168.0.101   60:01:94:19:2b:86   23 Hours 55 Minutes


About DNS, as I said earlier, most routers doesn't take care of adding new hostnames, you need to use mDNS with Bonjour to make that work, like mine above with "ping MyESPAP-192B86.local" .