-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need ability to send unicast MDNS answers #18
Comments
It's a long time since i read the MDNS RFC... So this would parse an Sounds like a useful helper function. |
I don't think the source IP is in any of the data structures. This would get the source IP for the packet from Udp.remoteIP(). From what I got out of the spec, if the unicast response flag is set in the query, the answer packet may be sent as a unicast not multicast response. Anyway, it's just a one line function so I was going to implement it right in the mins.cpp code. I could probably put it in the mdns_test example to show the source IP of the answer packet. |
I sent before finishing the thought. Sending unicast responses will also require a separate SendUnicast(IPAddress) function. The library can't decide by itself whether the answer is unicast or what address to send it to. |
ah. so the same packet format is used for unicast updates? for your |
oh. i obviously need to go read the RFC again. |
The original query packet has the real source IP address with a multicast destination address. The answer packet from the MDNS library can be sent either to the multicast address or the unicast address based on that flag. In the esp core implementation, if you start listening for multicast packets on a port, you also receive unicast packets as long as they're sent to the same port. Makes things simple There's actually a udp.destinationIP function that you can use to see if the packet was sent to the unicast or multicast address but we don't care in this case. |
Section 5.4 of the RFC (6762) covers the unicast flag. It just says the querier is willing to accept unicast responses or multicast responses. Using the unicast response just cuts down on the number of machines on the network that have to look at the packet. |
ok. |
Thanks. I'll add an example of a simple MDNS responder that selects unicast or multicast response based on the flag. |
1. Add SendUnicast(IPAddress) and supporting functions getRemoteIP() and getDestinationIP() 2. Bug fixes in MDNS answers code
SendUnicast() function and supports (#18)
i forgot all about this. |
The MDNS spec section 5.4 details the ability for queries to request a unicast reply to cut down on multicast traffic on the network. Add a function to send a unicast answer instead of multicast packet
The text was updated successfully, but these errors were encountered: