Left for archival purposes.

User avatar
By ronyb29
#9001
sej7278 wrote:so just assign it a hostname on your pc or router based on ip address (/etc/hosts) or mac (/etc/ethers), assigning a hostname on the esp itself solves nothing


I believe the idea was that this happened automatically; think about what happens when you try to distribute a ESP based product (be it OSS, or actually selling it), not having it send your hostname is a big usability hit. The popularity of OSS projects (and the size of the community) depends basically on the barrier of entry.

For example, figuring out your ESP's ipaddr and setting it in your router on every new network is about 10 steps (they're not hard, i grant you that) that can automated by patching the DHCP client to send the hostname when it asks for an IP.
User avatar
By sej7278
#9002 your router's dhcp server assigns a hostname based on mac address, if you've configured it in your dhcp server (usually /etc/ethers) in the same way it can give out a static dynamic ip address. not the other way around.

you can make a dhcp client send its hostname as part of the dhcp request, but its pretty non-standard.

horrible things like mdns (avahi/zeroconf/bonjour) that multicast their hostname are probably the most user-friendly solutions.
User avatar
By kadamski
#9166 I thought it's a good idea and tried to do that. LwIP has a support for this feature but enabling this is probably a little bit harder than we would like. I've implemented this on my own version of LwIP
(https://github.com/kadamski/esp-lwip). Currently, the DHCP client on device will sent hostname set to "esp8266-XXXXXX" (where XXXXXX are 3 least significant bytes of mac address) to the server. I'm also thinking about implementing some API to change it from inside of user application.

Unfortunately it's not easy to use - not only you have to compile my liblwip.a (which is not fully test) but you also have to switch eagle_lwip_if.o inside of libmain.a (part of SDK) to my own version. I can provide you with some instructions if someone is interested and would like to test this.