Thanks for the reply. 

The WiFi network at work must have disabled multicast. It works on my home WiFi 
network. However, that makes me wonder why I can discover printers on that same 
network. 

----- Original Message -----

From: "Carl Hoefs" <newsli...@autonomy.caltech.edu> 
To: "john dumais" <john.dum...@comcast.net> 
Cc: macnetworkprog@lists.apple.com 
Sent: Wednesday, November 25, 2015 5:53:52 PM 
Subject: Re: Can't discover bonjour service 

I do this very same thing in my iOS 8 apps, and it works for me. However, I 
seem to recall that I never could get it to work if I used @"" for the domain. 
Have you tried supplying a non-zero length string for the domain name (same on 
both sides)? 
-Carl 




On Nov 25, 2015, at 4:25 PM, john.dum...@comcast.net wrote: 

Hello, 

I was trying to use peer-to-peer networking between 2 iOS 8 devices but could 
not figure out how to keep the 2 apps from randomly disconnecting, so I thought 
I’d try to use bonjour. However, I can’t find an advertised service using the 
same devices I used when trying to communicate through a p2p connection. 

The advertiser code looks like this… 

+ (NSString*) proctorServiceType 
{ 
return @"_ick._tcp"; 
} 

- (BOOL) startAdvertisingWithPatientName : (NSString*) patientName 
{ 
if( ! [self setupListeningSocket]) 
return NO; 
proctorService = [[NSNetService alloc] initWithDomain:@"" 
type:[BonjourProctorAdvertiser proctorServiceType] name:@"" port:servicePort]; 
if(proctorService == nil) 
return NO; 
proctorService.delegate = self; 
[proctorService publish]; 
return YES; 
} 

servicePort is 0. 

When I run this, my 
- (void) netServiceDidPublish : (NSNetService *)sender 
delegate method is getting called. 
However, the client side of the app, configured like this… 
- (void) startBrowsingForProctorService 
{ 
NSNetServiceBrowser *serviceBrowser = [self getProctorServiceBrowser]; 
[serviceBrowser setDelegate:self]; 
[serviceBrowser searchForServicesOfType:[BonjourProctorAdvertiser 
proctorServiceType] inDomain:@""]; 

} 

- (NSNetServiceBrowser*) getProctorServiceBrowser 
{ 
if(proctorServiceBrowser == nil) 
{ 
proctorServiceBrowser = [[NSNetServiceBrowser alloc] init]; 
} 

return proctorServiceBrowser; 
} 
never discovers the service. 
I checked that both devices are on the same WiFi network. That network has 
other bonjour devices on it that I can discover; an HP printer for example. I 
enabled bonjour in Safari, but it did not see my service, though I don’t know 
if Safari searches for anything other than _http._tcp. Changing my advertised 
service type to _http._tcp didn’t result in Safari finding it, but that was a 
long shot anyway. 
The other thing I tried was removing both devices from any WiFi network but 
that didn’t change the client not being able to discover the service, even 
though the netServiceDidPublish delegate is getting called when I select no 
WiFi connection. 
I’m not sure where to go from here, so any pointers would be appreciated. 
_______________________________________________ 
Do not post admin requests to the list. They will be ignored. 
Macnetworkprog mailing list ( Macnetworkprog@lists.apple.com ) 
Help/Unsubscribe/Update your Subscription: 
https://lists.apple.com/mailman/options/macnetworkprog/newslists%40autonomy.caltech.edu
 

This email sent to newsli...@autonomy.caltech.edu 





 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (Macnetworkprog@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/macnetworkprog/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to