DNS Name for Spark [SOLVED]

Hi,

we are currently working on a product based the famous SparkCore. To contact the Spark inside the WireLess LAN of our customers, they need to know the IP Adress within the Network (to get in direct contact).

Is it possible to set the DNS Name with Software?

Is there a reason for not using any DNS Name (like a production number)

For the normal customer its not possible to “Look for” the IP Adress in the local WLAN.

Our first idea was to populate the internal IP using the SparkCloud and get the Internal IP from the Website…

@softmeter,

You can use WiFi.LocalIP() to retrieve the IP address of the core. See: http://docs.spark.io/firmware/#wifi-localip

You can either Spark.publish() or print to Serial and capture the Local IP address.

DNS is used internally by the cc3000 for lookup.

I’m not sure what you meant be using DNS name though…

I believe you may be looking for this:

If you just want to call your Spark “Brad”, you can put an entry in your PCs hosts file to make that association.

If you want a more automatic or dynamic solution, you can try mDNS aka Bonjour but you should know:

It is a cooperative broadcast protocol so the core has to keep a continuous connection open to listen for other hosts that might want to use the same name and warn them off. The flip slide is that if you do have two cores that want to use the same name, you cannot in general guarantee that a particular host gets a particular name since the first one online will win. Maybe in your application you can guarantee the names they want to use are unique.

Normaly in DHCP during a DHCP-Discover Package you specify a Host Name, so the DHCP registers your HostName and your MAC using this name for DNS. Currently this HostName seems to be empty (which is allowed by the protocoll), so the DHCP registers no hostname (therefor you need the IP Adresse to reach your spark within your local network)

If you specify this hostname, you can call your spark later using this name (per DNS).

Normaly you can’t make a Default name like “spark” cause more then one spark (in the same subnet) will try to register with the same name (which is not allowed).

Other system try to use a ManufacturerID as part of this name to end up with for different Hostnames.

Yup, but this is only needed, if your network does not have an DNS Server. Today, any router or access point is a DNS Server providing DHCP and DNS capabilities.

[UPDATE]
I’ve found the answer inside a TI forum. It’s simply not implemented in the cc3000

http://e2e.ti.com/support/wireless_connectivity/f/851/p/206099/739673

:confused:

Here is a good Explanation for DHCP and DNS (from Arduino perspective)

http://notebook.kulchenko.com/embedded/dhcp-and-dns-servers-with-arduino

Hi @softmeter

DHCP happens entirely inside the the TI CC3000 so we don’t have much control over that.

mDNS aka Bonjour is very useful to discover devices on a network even with DNS. That is how you can find your printer or your scanner or your NAS via its attributes. It is particularly valuable on mobile devices that might join different WiFi networks. The protocol is designed to run on smaller processors like printers but it is cooperative and the hosts need to listen all the time for updates. You might think it could be a perfect fit for Spark but it consumes a lot of resources on such a small host.

Yes, this is not an option at all. Maybe the Photon will implement DHCP with Hostname

Thx

In another forum i've found the cc3000 is capable of netbios and mDNS.

https://www.ghielectronics.com/community/forum/topic?id=13347

I just checked in (http://cc3000.codeplex.com) local name resolution that appears to work! I went through a few options, mDNS, LLMNR, DHCP Inform, and NetBIOS Naming. I really wanted LLMNR to work, but despite the cc3000 sending what looked like perfect responses, the clients never seemed to accept the name. The DHCP Inform, just didn't work, I think you have to specify hostname in the initial DHCP negotiation with the router and I don't have that level of control with the cc3000. So, I ended up, unbelievably, with the oldest method... NetBIOS Naming. It just plain works... The mDNS worked almost immediately. So with those 2 working and a web server running, I have now run for 24 hours! The image is what my testing looks like. That's my development machine (windows 8.1), an iPad 2, and a Surface RT. All of which are happily resolving the name "cc3000.local". Now, you might ask, what about my Android!? Well, I have a Nexus 7 for testing of that platform as well, but guess what... Android does not support any local name resolution. So, there is nothing you can do to make it work, other than setting the hostname through DHCP and letting the router answer the DNS request, but as I mentioned, I don't have that level of control on the cc3000. I have suggested the change to TI, with no response.

Hi @softmeter

I think you must have missed the link that @peekay123 provided above to a mDNS client for Spark. It works fine but sometime consumes more resources than I would like.

2 Likes

yep

No. This one
http://processors.wiki.ti.com/index.php/CC3000_mDNS#Basic_WiFi_Application

The TI one does not actually fully implement the mDNS spec–it just does the broadcast message without listening for any other host using that name. It also did not work with any nDNS listener that I tried but your mileage may vary.

1 Like