Questions tagged [nsnetservice]

The NSNetService class represents a network service, either one your application publishes or is a client of. Available in OS X v10.2 and later with Apple's Foundation framework.

The methods of NSNetService operate asynchronously so your application is not impacted by the speed of the network. All information about a service is returned to your application through the NSNetService object’s delegate. You must provide a delegate object to respond to messages and to handle errors appropriately.

NSNetService class and the NSNetServiceBrowser class use multicast DNS to convey information about network services to and from your application. The API of NSNetService provides a convenient way to publish the services offered by your application and to resolve the socket address for a service.

The types of services you access using NSNetService are the same types that you access directly using BSD sockets. HTTP and FTP are two services commonly provided by systems. (For a list of common services and the ports used by those services, see the file /etc/services.) Applications can also define their own custom services to provide specific data to clients.

Source: NSNetService class reference

Related tags:

112 questions
12
votes
1 answer

NSNetServiceBrowser/Bonjour issues on iOS

I'm using Bonjour (NSNetServiceBrowser, to be precise) over WiFi in an app I'm developing for an iOS project I've been working on. However, despite noting the issues raised in the excellent response at Why does NSNetServiceBrowser find unpublished…
Jonathan Ellis
  • 5,221
  • 2
  • 36
  • 53
10
votes
4 answers

Swift 3 how to resolve NetService IP?

Just trying Bonjour in swift 3 Here is my code , I can receive the delegate func netServiceDidResolveAddress(_ sender: NetService) { print("netServiceDidResolveAddress service name \(sender.name) of type \(sender.type)," + "port…
Webber Lai
  • 2,014
  • 5
  • 35
  • 66
7
votes
2 answers

NSNetServiceBrowser didRemoveService takes longer after opening stream

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…
Yvo
  • 18,681
  • 11
  • 71
  • 90
7
votes
0 answers

Get connected service name using NSStream's and Bonjour based NSNetServices peer to peer

I have a problem with obtaining a connected service name on the other device. I am using NSNetServices based on Bonjour and input and output streams for peer to peer connections. I have an iPhone and iPad device. When I try to connect to the iPad…
piotr_ch
  • 508
  • 3
  • 7
  • 17
7
votes
2 answers

Converting [NSNetservice addresses] to ip address string

This question was already asked here: NSNetservice IP address and here: iPhone: Bonjour NSNetService IP address and port I've used both of those to get where I'm at now. My problem is the following method I have doesn't quite work: - (NSString…
mjdth
  • 6,536
  • 6
  • 37
  • 44
6
votes
1 answer

Get local network hostnames in iOS

I would like to get All device name in entire local network. I just been searching over 2 days and haven't find a solution yet. I can able to get Bonjour services with using NSNetServiceBrowser. What i am trying to do is same as Fing app ( in app…
Onder OZCAN
  • 1,556
  • 1
  • 16
  • 36
6
votes
1 answer

dyld: Symbol not found: _OBJC_CLASS_$_NSNetService Error

So I have the following problem: launching my application on iOS 8 on my iPhone 5s, I get no error, but launching my app on iOS 6.1.3 on my iPhone 3GS, I get this error: dyld: Symbol not found: _OBJC_CLASS_$_NSNetService Referenced from:…
iComputerfreak
  • 890
  • 2
  • 8
  • 22
5
votes
3 answers

NSNetService dictionaryFromTXTRecord fails an assertion on invalid input

The input to dictionary(fromTXTRecord:) comes from the network, potentially from outside the app, or even the device. However, Apple's docs say: ... Fails an assertion if txtData cannot be represented as an NSDictionary object. Failing an…
ateijelo
  • 280
  • 1
  • 8
5
votes
1 answer

NSNetServiceBrowser delegate not called when searching

I got a really annoying problem. Im trying to search after a NSNetService (that i know exist). I've copied the example code from http://www.macresearch.org/cocoa-scientists-part-xxviii-bonjour-and-how-do-you-do into my own application. I can see…
Jonas Jongejan
  • 2,826
  • 1
  • 16
  • 17
5
votes
1 answer

Knowing status of a bonjour service

I'm using NSNetService and NSNetServiceBrowser to publish and scan for Bonjour services on the network. The implementation is working fine, the services are found on the network and they are capable of communicating. I'm currently trying to…
André Fratelli
  • 5,920
  • 7
  • 46
  • 87
5
votes
3 answers

what cause error NSNetServicesErrorCode = "-72000"?

i create a simple browser that can load a local file using UIWebview. At first,when i try to preview a html file, the uiwebview can load the source file and preview it. But after i minimize the app (the app enter background), and then open the app…
R. Dewi
  • 4,141
  • 9
  • 41
  • 66
4
votes
2 answers

How to Connect multiple peers on the iPhone Application over WiFi?

I have an idea for an ios(iPhone) application to which requires connecting to several peers. I am basing my code on the WiTab (SampleCode-developer.apple.com) example. When my application started each peer creating separate Socket(CFSocket) and…
Musthafa P P
  • 645
  • 3
  • 7
  • 21
4
votes
3 answers

Apple Bonjour: how can I tell which published service is my own?

I have two iOS devices finding each other successfully using the Bonjour API, but since they are both simultaneously publishing and browsing, they also see themselves appearing in the list of available services. There must be some bit of information…
iforce2d
  • 8,194
  • 3
  • 29
  • 40
4
votes
1 answer

Creating a Bonjour AirPrint service in iOS device

So I figured out that to publish (announce the service) to an iOS device as a printer, I use NSNetService and set the type to _ipp._tcp. But in order to be recognized as an AirPrint printer the requirements include: AirPrint uses IPP for print…
Prasanth
  • 646
  • 6
  • 21
4
votes
1 answer

How do we detect if wifi becomes unavailable in iPhone SDK

Is there any way that we can programatically identify when the wifi of a user becomes available/unavailable? My application requires exchanging messages between two different devices. It is working good in stable wifi setups. But if the wifi is…
1
2 3 4 5 6 7 8