I have been reading about mDNS in preparation for the DAAP client that is coming along nicely. mDNS is the component of DAAP applications that allows automatic discovery of shares on the local network. mDNS is a portion of Apple's Bonjour (formerly Rendezvous) protocol. The way that mDNS works is by essentially creating a pseudo-distributed DNS name server on the local network. Whenever a client wants to discover information about which services reside on the local network, that client creates a query to a multicast address. All machines that posses some DNS records will receive this query. The machines that has information regarding that query will reply.
JmDNS is an implementation of mDNS in Java that is very simple. They have a sample application that fetches information about the network and displays what is discovered graphically. I mimicked this code in an attempt to discover all DAAP servers on the network. I always received information that a DAAP server existed on the network, but when my application attempted to resolve the name of the server, JmDNS would never issue the callback. My application would wait indefinitely for this callback and never know how to talk to the server. This was strange to me as wireshark showed that mDNS was behaving properly and returning the address when my application was resolving the name. JmDNS was just not issuing the callback. Even more strange was the sample application included in the source would always resolve. I found a thread on the support forums at sourceforge where someone describes the same problem. They noted that the only difference between their application and the sample one was that they request was issued in a thread. Wrapping just the request for resolving a name in a thread strangely fixes the issue. I filed a bug here. Now we can move forward and incorporate the great feature of automatic server discover for DAAP into our android client.
Subscribe to:
Post Comments (Atom)
2 comments:
yayayayayay
Hi Chris - I've run into some similar issues on Android. I see 3.1 was pushed out, but doesn't appear to resolve the issue.
Have you revisited this? I'm trying to write an Android app with this very feature, and naturally finding it quite frustrating! ;)
I'd love to talk with you about this and share what I learn. I'm peter (at) create digital music (dot) com.
Post a Comment