- Sat Jul 23, 2016 1:17 am
#51319
I'm digging though the code of the ESP8266mDNS "library" (it's a single source file) and it's clearly meant to handle both responding to mDNS requests from other network entities, *and* making queries on the network.
There's a bunch of code there for parsing response packets and storing the data. (I think it has to work this way, because both directions of querying need to use the same port, 5353.)
I just can't get it to work.
After various setup, I make the call (cribbed from example code):
int n = MDNS.queryService("http", "tcp");
Watching packets on the network, it sends a query, and three things on my net reply (two printers and an ip camera -- with completely valid responses). I turned on MDNS_DEBUG_RX in the code and I can see it's receiving the packets - and then throwing them all away after the debug message: "Expected a packet with 4 answers, returning"
If I comment out that entire error check, it gets a bit farther, but still fails.
The parsing code looks really grotty to me. Anyone else fixed it already? Anyone? Bueller?
I suppose I'm going to have to wade into it.