• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Can't discover bonjour service
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can't discover bonjour service


  • Subject: Can't discover bonjour service
  • From: email@hidden
  • Date: Wed, 25 Nov 2015 23:25:07 +0000 (UTC)
  • Thread-topic: Can't discover bonjour service

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      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Can't discover bonjour service
      • From: Carl Hoefs <email@hidden>
  • Prev by Date: network configuration change notification
  • Next by Date: Re: Can't discover bonjour service
  • Previous by thread: Re: network configuration change notification
  • Next by thread: Re: Can't discover bonjour service
  • Index(es):
    • Date
    • Thread