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

Nathan Carter nathancarter5 at gmail.com
Mon Mar 30 19:41:57 CEST 2009


Hi Brad,

Thanks for the reply.  Here's mine:

>> 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.
>
> This probably reflects that the server is available over two different
> network devices. The default behavior for a published service is to
> enable provide connection information over all active networks.

Ah, yes, that was mentioned in the article and I forgot it.  Okay, so  
that's not the problem.  Thanks.

>> 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
>
> These are IPv6 addresses.
>
>>
>> 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
>
> Again, IPv6 addresses. Try disabling IPv6 and see if things improve.

Yes I knew they were IPv6, but I'm not sure how to disable that.  That  
is, the code simply passes the QHostAddress object to  
QTcpSocket::connectToHost(), and that doesn't seem to have a way for  
me to specify the QAbstractSocket::NetworkLayerProtocol.  Furthermore,  
QHostAddress::protocol() is read-only.  What did you mean by "try  
disabling IPv6"?

> I've worked extensively with Zeroconf and Qt, and my code still works
> without change after moving to Qt 4.5, so I'm fairly confident that
> the problem you are seeing is not a Qt-specific issue.

Glad to hear it!  That means there's good hope for me fixing this issue.

> That said,
> there may be bugs in their code when there are multiple interfaces
> found for a service. When you click on a service to use, it is very
> important that you provide the correct interface ID or else you will
> have problems.

I apologize, but I don't know what interface IDs are.  The code in the  
article encapsulates Bonjour records inside some Qt-like classes, so I  
expect this detail is in there, which suggests that interface IDs are  
being kept track of correctly.  But I haven't checked; I'll return to  
that issue if the IPv6 idea doesn't pan out, but it seems lower- 
probability to me, because it was the focus of the QQ article in the  
first place, so it has a higher probability of having been coded  
correctly.

Nathan (your neighbor in Waltham)




More information about the Qt-interest-old mailing list