BLIPConnection bonjourServiceName

3 views
Skip to first unread message

Ducky

unread,
Oct 14, 2009, 12:52:25 PM10/14/09
to BLIP Protocol
OK, I've got everything basically working and messages are being
accurately sent between client/servers, but I just can't wrap my head
around how to do the following...

I thought it would be possible to get the name of the connection
(server) using:

NSLog(@"%@",[[connection1 server] bonjourServiceName]);

as in the following code snippet:

MYBonjourService* selectedServer = [self.servers objectAtIndex:x];
connection1 = [[BLIPConnection alloc]
initToBonjourService:selectedServer];
NSLog(@"%@",[[connection1 server] bonjourServiceName]);

but I always get NULL.


Of course I can get the name from

NSLog(@"%@",[selectedServer name]);

but can't you get that info from the BLIPCOnnection object itself?

Thanks in advance for pointing me in the right direction.

-John.

Jens Alfke

unread,
Oct 14, 2009, 5:11:43 PM10/14/09
to Ducky, BLIP Protocol
There are a couple of things wrong with what you're doing:

(1) The TCPConnection.server property is only valid for incoming connections. It returns your local TCPListener that created this connection object in response to an incoming TCP connection. If called on an outgoing connection, as you're doing, it just returns nil.

(2) The TCPListener.bonjourServiceName property is local. You set it on your listener to define what Bonjour service it should advertise. It has nothing to do with the names of other services you find on the network.

There's no direct association between an outgoing TCPConnection and a Bonjour service. The connection just knows what IP address and port it's connected to.

—Jens

Ducky

unread,
Oct 14, 2009, 7:24:43 PM10/14/09
to BLIP Protocol
Thanks Jens.

I think I'm slowly piecing it all together.

-John.
Reply all
Reply to author
Forward
0 new messages