• 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
Re: Directly creating NSNetService
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Directly creating NSNetService


  • Subject: Re: Directly creating NSNetService
  • From: "Quinn \"The Eskimo!\"" <email@hidden>
  • Date: Mon, 10 Sep 2012 13:05:03 +0100

On 10 Sep 2012, at 07:06, Rick Mann <email@hidden> wrote:

> Awesome, thanks for the explanation. I'm still puzzled by the docs, though. They clearly say I can use it directly.

You can and should construct an NSNetService directly when you're reconnecting to a service that your previously connected to.  The classic example of this is a printer.  Initially the user chooses a printer by browsing.  At this point the printing system remembers the name, type and domain of the chosen NSNetService.  Later on, when the user goes to print again, the printing system reconstructs the NSNetService from the name, type and domain and then connects to that.  This is the recommended way to remember and then reconnect to a service.

OTOH, if you know the DNS name and port, you should connect via CFStreamCreatePairWithSocketToHost, just like Jens suggested.  You can find the code for this in QA1652 "Using NSStreams For A TCP Connection Without NSHost".

<https://developer.apple.com/library/ios/#qa/qa1652/_index.html>

Share and Enjoy
--
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware



 _______________________________________________
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:
    • Broadcast Protocols
      • From: Gordon Apple <email@hidden>
References: 
 >Directly creating NSNetService (From: Rick Mann <email@hidden>)
 >Re: Directly creating NSNetService (From: Jens Alfke <email@hidden>)
 >Re: Directly creating NSNetService (From: Rick Mann <email@hidden>)

  • Prev by Date: Re: Some ports blocked by default?
  • Next by Date: Re: Blocking / Holding data from NKE
  • Previous by thread: Re: Directly creating NSNetService
  • Next by thread: Broadcast Protocols
  • Index(es):
    • Date
    • Thread