[Qt-interest] QQ article on zeroconf/bonjour: code not working

Nathan Carter nathancarter5 at gmail.com
Mon Mar 30 03:29:03 CEST 2009


Dear List,

I downloaded the code at this Qt Quarterly article:

	http://doc.trolltech.com/qq/qq23-bonjour.html

It's an example fortune client and server that use zeroconf/bonjour  
for service discovery.  I built it on my MacBook Pro (OS X 10.5) with  
Qt 4.5 and I have the following unexpected behavior.  I'm hoping  
someone on this list (perhaps even Trenton, the article's author, who  
I suspect is on this list?) can help me out.

Well, first the expected behavior:
1. Everything builds and launches (client and server).
2. I did not need to compile/link with any Bonjour code, because it  
was built in on my OS.
3. If the client is launched WITHOUT launching a server, it finds no  
servers, and doesn't activate the "get fortune" button.
4. The server, when launched, claims that it has acquired a port (e.g.  
56877).

Now, the unexpected behavior:
1. The client, when launched, claims to have found two different  
fortune servers on my machine, although I'm running only one instance  
of the server application.  One of these appears the moment the client  
application is launched, the other after a delay of about 1-2 seconds.
2. When I click "get fortune," having selected the first of the two  
identical fortune servers, the client pops up a dialog saying "The  
following error occurred: Host unreachable."  I click OK, and the  
dialog reappears (without my having taken any action) again about 5  
seconds later.  I click OK, another 5 second delay, and one final time  
the dialog appears.
3. When I insert a debugging statement in Client::connectToServer() in  
client.cpp, I find that my one click of the "get fortune" button  
actually caused three calls to that function in rapid succession,  
giving output like this:
	Host ip address: QHostAddress( "FE80:0:0:0:21C:42FF:FE00:1" ) port:  
56877
	Host ip address: QHostAddress( "FE80:0:0:0:21C:42FF:FE00:1" ) port:  
56877
	Host ip address: QHostAddress( "FE80:0:0:0:21C:42FF:FE00:1" ) port:  
56877
4. When I click "get fortune," having selected the other of the two  
identical fortune servers, the client prints one debugging message  
like this (after about a 1 second delay) and never pops up a dialog,  
nor fetches a fortune.
	Host ip address: QHostAddress( "FD1F:F24:76D2:629A:21B: 
63FF:FE9D:C18" ) port: 56877

Anyone have any experience with zeroconf/bonjour and Qt 4.5, or this  
code in particualr?  Thanks!

(At the very least, I suggest the QQ article (or its code) be updated  
to work with Qt 4.5, if that turns out to be the problem, or at least  
some hints posted as to why it might fail in this way.)

Nathan




More information about the Qt-interest-old mailing list