Resolving Host on mDNS

photon
Tags: #<Tag:0x00007fe21b85dab8>

#30

Ok. Also, I am getting an error in using the joinMulticast() function saying it does not exist! I guess I will have to start there to join the group.


#31

Make sure you’ve correctly set the PLATFORM environment variable for your build. If you don’t set PLATFORM, the default is CORE and the Spark Core doesn’t support multicast UDP on any Device OS version.


#32

Yes. I have set it as photon only. I am currently changing the OS version and compile the same code to make sure it is not a version issue, which is very unlikely.
Another weird thing which is happening is the error is coming up only when I include the line in the main application. When inside a library file though, it is not throwing compilation error, however, it is not working. It is giving the return value -1


#33

My suggestion was entirely focused on your previous statement

To distiguish causes

  • when Web IDE builds with the code but your local toolchain doesn’t you’ll have an issue with the repo used for your local toolchain
  • when Web IDE doesn’t build you’d either have the wrong platform or device OS version targeted (as elboarted further up already)

Is your application file a .ino or a .cpp - if the latter you should add a #include <Particle.h> statement. Also try to not name your main file application.*


#34

Ok. Well I did try with v1.2.0 and it threw the same error. I am currently trying in v0.8.0 hoping for a different reply.

Why so? My main file is application.cpp
Also, I did find that while flashing using the Web IDE it did not throw an error. I guess there is some #define missing somewhere in the repo which I am using which is highly unlikely.


#35

Local or Web IDE?
If Web IDE, post a SHARE THIS REVISION link to let us see.
If local - my assessment from above still stands


#36

But I just cloned the latest repo and used the branch v1.2.0 which threw the same error


#37

It doesn’t for me from 0.4.5 onward - neither local (using Workbench) nor cloud.

Have you tried a make clean?


#38

Yes I have. And also all the other functions are working so it not likely the compiling pipe is broken.


#39

The udp.begin() function given in the spark_wiring_udp.cpp expects two parameters: port and the network interface but in usage we pass only the port number. Which udp library is the photon expected to call exactly because it doesn’t seems to b e this one under wiring/src/spark_wiring_udp.cpp


#40

If you look at spark_wiring_udp.h you’ll know why.


#41

Ok. That does answer that.
Another query I had is, Is it possible to copy a UDP library of another board, say EP8266, and use it as an include in my application. As I am using one of their libraries that depend heavily on lwIP which is not accessible in particle. If I make an include which will have all the necessary lwIP and the ESPUDP files, will it work or it will have massive issues due to change in platform?


#42

Most likely not since the network stacks between the two platforms are entirely different and I doubt any ESP UDP library would be that hardware agnostic that it could be transferred over without a good amount of rework.


#43

Any other possible way to resolve a hostname on mDNS on particle photon apart from porting an ESP library and spending hours clearing all the dependencies without any guarantee it will work?
I also thought about using the current mDNS library present in the particle and include the feature of sending and resolving QTYPE A queries but even that will require a lot of effort to understand the library and add those features at the right place. However, this seems to be the only path left for now.


#44

Hey is it possible to modily your serverLocater code on github and use it to send QTYPE A and resolve the host IP? Maybe we can work together and convert it into a library used just for host IP resolving?


#45

Where did you find this information? I am hoping to find the response part of it too so that I can make it work somehow.


#46



#47

Hey, is it possible to start a service on the host on which it sends it’s current dhcp IP address so that the photon can subscribe to it and get the IP Address?


#48

Hey. Some new developments. While testing with the MDNS library for photon, I found that the particle is unable to join the multicast group after some time. It is working fine in the beginning but after some time it is dropping off of the group and unable to join again. Any views on why this must be happening? I have tried leaving the multicast group and joining again but to no vain.


#49

Hey. So I forgot to update here. I was able to modify an ESP8266 library for particle photon to resolve the mDNS host IPs. It takes in the host name “host1.local” and returns it’s IP on the subnet. I will post it on my github. Ping me if anyone needs it. Thank you everyone for your help.