title: discover iOS device name using mDNS
body: <p>I notice that some of the better network discovery apps like Fing for iOS and iNet for Mac are able to discover the device name of iOS devices and Mac devices even when they are not advertising Bonjour services such as iTunes Wi-Fi Sync.  How is this done?  I am aware of how to do a reverse mDNS query <a href="https://serverfault.com/questions/143184/how-do-i-get-the-machine-name-from-an-ip-via-multicast-dns">https://serverfault.com/questions/143184/how-do-i-get-the-machine-name-from-an-ip-via-multicast-dns</a>.  But while a reverse mDNS lookup (at least as accomplished by the dig command <code>dig -x the.ip @224.0.0.251 -p 5353</code>) will work against a Mac that is not otherwise broadcasting any Bonjour services, it doesn't work unless Wi-Fi Sync is running or some other Bonjour service on an iOS device.  I am not sure how to get the name otherwise but these apps reliably get it.  I used Wireshark while iNet was discovering and I only see ICMP and NetBios queries all which return 0 answers. </p>
  
  <p>Also note that I have the IP address of the device already by doing a broadcast ping and then parsing the ARP table. I want to discover which of the devices discovered in this way are iOS devices by getting their device name and looking for the string "iPhone" or "iPad".</p>
  
  <p>Also note that the iNet app website provides the following about how they do reverse IP lookups.  I take this to mean they do a reverse DNS lookup and a reverse mDNS lookup for every IP.</p>
  
  <p><code>Reverse IP lookups (host­names) are per­formed as unicast and mul­ti­cast queries for every IP found.</code> -<a href="http://www.bananaglue.de/inet/index_e.php" rel="nofollow noreferrer">http://www.bananaglue.de/inet/index_e.php</a></p>