That only sets the hostname for dhcp. Once dhcp knows something of it, it should work a little better. The esp uCs support mdns which allows for better naming without dhcp or DNS infrastructure. Whereby you can connect with xxx.local. So long as you have a multicast resolver and on the same segment, everything works.
setHostname() Description Sets the hostname of the module, the hostname is sent in WiFi.begin(...) when an IP address is requested from a DHCP server.
This ins't an ESP chipset. The device gets a DHCP address, and should, according to bugfixes, set the active hostname as seen by the router. There are various bug reports from firmware dating back a year stating that it won't.
I assume they either broke it again or didn't fix it in the first place.
Yes, I understand it's not an esp. That's why I suggested looking into them. Their RF stacks are very mature. Which sadly, isn't the case with the arduino core stuff.
One of the issues here is you can't set a hostname without DHCP and DDNS support, unless you use mDNS. If you set a hostname and don't have DDNS support at your DHCP server, the hostname has no visibility. Locally, you're likely addressing the interface as 0.0.0.0 (any), a specific IP, or loopback.
Additionally, a DHCP server is free to ignore the requested hostname. Especially if it does not have a static configuration. Meaning, device says I want info for myname. DHCP server says, the IP for myname is 1.2.3.4. Assuming you also have DDNS functioning with your DHCP server, you can now resolve myname to 1.2.3.4. Which means the device should also have visibility of the name.
There are many factors which can effect what you're seeing. As you acknolwedge, potential bugs may also be a factor. Which is why for networking, I encourage you to look at the esp stuff. Even the older esp8266 in one of the tiny form factors is a very useful addon for otherwise normal arduino projects.
The other advantage of the esp stuff is you can run freertos without the arduino layers, if you're so inclined. This provides lower level access to much functionality, in addition to multitasking and synchronization primitives. While also providing a smaller footprint. The esp devices also have nice flash footprints, which allows for useful web serving and so on.
Her's what I know about the situation:
The device providing the response to the DHCP request is very good about accepting the hostname in the request, the only time I've found that it will not is if the request is malformed. HOWEVER, the arduino is providing a hostname, that of "arduino-xxxx" so whatever is sending that request (The ublox wifi device) is ignoring the code telling it to change this hostname. This problem was acknowledged in issues raised several firmware revs ago, and was slated as "to be fixed in the next revision." Apparently, it was not.
I've done some intensive development with ESP devices - I had a project where there was a need for a cheap, deployable temp/humidity sensor that would work off of something like an old cellphone charger. This worked, but I rapidly found out the ESP has two big problems:
1 - They had a hard time maintaining communication with bit-banged devices. Never could get this to work properly, I assume it was both the device and the chipset because some would work forever, others would drop comm in a day.
2 - They're VERY noisy. The ESP family spews massive amount of radio interference at 318MHz. This is problematic because many commercial radio devices such as garage door openers operate at 320MHz. With no filtering on the input, the noise emitted by the ESP devices is wideband enough that it kills the signal to the other device. 5 ESP8266 deployed in a 100 foot radius is enough to kill any chance of a 320MHz device operating. A single ESP32 device within 10 feet of my home garage door opener pegs the receive LED signal strength indicator.
I had to abandon these devices as it killed both my customer's systems, and some of the ones in my home area. This wasn't limited to just the -01, I tried 01, 02, 03, 07, and 12. They simply are junk if you're expecting a quiet device.
The ESP family is a great, cheap system, but with that system you have some serious issues that more expensive and better-refined devices don't have. I have a box full of 1s, 2s, and 3s that I've been selling off over the past two years, I'm just about out of them.
(post is archived)