Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8310373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:26:13+00:00 2026-06-08T19:26:13+00:00

I have the following code for discovering services on the network: [netServiceBrowser setDelegate: self];

  • 0

I have the following code for discovering services on the network:

[netServiceBrowser setDelegate: self]; 
[netServiceBrowser searchForServicesOfType: serviceType inDomain: domain];

That results in calls to these two methods (find service and remove service):

- (void) netServiceBrowser:(NSNetServiceBrowser*) netServiceBrowser 
         didFindService:(NSNetService*) netService ... {}

- (void) netServiceBrowser:(NSNetServiceBrowser*) netServiceBrowser 
         didRemoveService:(NSNetService*) netService ... {}

This works fine. When I turn off my device I immediately receive the didRemoveService call.

However when I open a stream (input, output or both) to the device:

[netService getInputStream: &inputStream outputStream: &outputStream];

[inputStream setDelegate: self];
[outputStream setDelegate: self];

[inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop]
             forMode: NSDefaultRunLoopMode];
[inputStream open];

[outputStream scheduleInRunLoop:[NSRunLoop currentRunLoop]
              forMode:NSDefaultRunLoopMode];
[outputStream open];

It suddenly takes the NSNetServiceBrowser almost a minute to detect that I turned off the device
(it takes a minute for didRemoveService to be called).

Devices that I’m not communicating with (opening streams with) still call didRemoveService as soon as I remove them.

Update:
Here is a bit more information related to my problem.

I’ve ran a trace with Wireshark and noticed the following:

I start my application in the iPad simulator, the application starts a
NSNetServiceBrowser and detects the printer. After that it opens the
input/output streams to the device (via airport express, usb). The
printer is sending me status updates and when I tap the test button in
my app the printer starts printing. In Wireshark I see all the
communication with the printer as expected.

Now when I start the exact same application on the iPad (and leave the
iPad simulator running). The application starts the
NSNetServiceBrowser as well, and detects the printer. The printer is
not sending me status updates and when I tap the test button, the
printer is not printing. In Wireshark I see the communication. The
printer or airport receives my commands and sends an ACK package.

As soon as I kill the iPad simulator app, the printer starts to print
the commands that I’ve sent using the iPad. It seems that opening a socket blocks all bonjour events, how can I prevent this from happening?

More here: https://devforums.apple.com/message/541436

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T19:26:14+00:00Added an answer on June 8, 2026 at 7:26 pm

    It seems to be a limitation of the Airport Express.

    My current implementation with GCDAsyncSocket works pretty well and I just have to make sure that only one socket is used to communicate with the Airport Express.

    I’m closing the question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following code that I am compiling in a .NET 4.0 project namespace
I have following code that displays an Image with letters, public class MainActivity extends
I have following code that creates Linq query. I've never used Linq until today
I have following code snippet: self.xmlHttpReq = new XMLHttpRequest(); self.xmlHttpReq.onreadystatechange = function() { if(self.xmlHttpReq.readyState
I have following code that is executed when doing a mouseenter on a div
I have following code in initialization im = imread('Image02.tif'); figure(); imagesc(im); colormap(gray); [hImage hfig
I have following code <div id=main> <div id=one> </div> <div id=two> </div> <div id=three>
I have following code for updating user's column public void UpdateLastModifiedDate(string username) { using
I have following code for loading image from url in xml parsing endElement method
I have following code for inserting data into database using PDO. It inserts data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.