Hostname does not show up in network scans


#1

I want to be able to use a name hostname.local when trying to TCP/IP connect to a Photon within a Wireless LAN.

I understand that the Photon’s hostname is by default its device id, or as set by WiFi.setHostname().

Another way of putting this is: I want to ping hostname.local

Using a common network scanning tool such as Fing, the device shows up with DHCP name of “Generic” instead of the configured hostname.

This is a common use case and have seen others wanting to perform this without having to resort to fixed IP’s.


#2

Am closing this case - as I have since learnt that the hostname is sent the DHCP server in the broadcast when it asks for an IP but has no other function other than being put into a table in the DHCP server. So, one can’t use it for pinging.


#3

This is where Bonjoure and/or mDNS would be used.
There are some discussions about that in the forum.


#4

Thanks @ScruffR, came to that conclusion once I realised I was going down the wrong track.

Can you recommend which way to go? Would like to have the simplest and lowest overhead solution (like everybody else).


#5

I haven’t actually used mDNS since I have all my home devices set up with static routes and port forwarding. But the MDNS library seems to be the way to go.
And you’ll need the Bonjoure service running on your client machine(s).


#6

Yet to investigate, but the client machine in this case is another Photon…


#7

@ScruffR, for the record, have good news.

  • fixed the OpenWRT router issue which was not serving DHCP properly when there was no WAN connection (can you believe it?)
  • the router is running the dnsmasq DHCP service
  • Used WiFi.setHostname() to set a hostname, say DEVICE1 on a device running TCPServer
  • Another Photon using TCPClient could then access DEVICE1 using the name DEVICE1.lan
  • Conclusion: no need for fixed IP’s!

Case closed!