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
4
votes
0 answers

can we stream audio using corebluetooth technology to multiple ios devices?

Can we stream audio using Core Bluetooth technology to multiple ios devices? I am able to find and send small test messages to nearby ios devices. Core Bluetooth Framework and NSNetservice…
Nandakumar R
  • 1,404
  • 11
  • 17
4
votes
1 answer

Disconnecting with server immediately after connecting

I have written a Singleton Class using GCDAsyncsocket Library to establish connection with any other device having same service using Bonjour. On one device I am using its Method "startPublishing" to make it a Host(Server), from the Application on…
Mrug
  • 4,963
  • 2
  • 31
  • 53
4
votes
2 answers

How to get ip address from NetService

When I get a NetService object,I try to do: NSNetService *ss=[netArray objectAtIndex:indexPath.row]; ss.delegate=self; [ss resolveWithTimeout:3.0]; On the delegate method: -(void)netServiceDidResolveAddress:(NSNetService *)sender { NSArray…
Vic
  • 61
  • 1
  • 7
4
votes
2 answers

Connect to and send data via NSNetService

I'm trying to set upp a communication between a iPhone app and a Mac app using NSNetService. I've come so far as to setup the Mac app to publish a NSNetService that the iPhone app can discover but I can't figure out how send data between them. In…
fredrik
  • 17,537
  • 9
  • 51
  • 71
4
votes
1 answer

NSNetService/Bonjour discovery only works on iPhone simulator

I'm working on an iPhone app that requires a basic client/server interaction model. For this I am going to use Bonjour and NSNetService, along with NSNetServiceBrowser to discover others on the same network. I have followed several different guides…
nrj
  • 1,701
  • 2
  • 22
  • 37
3
votes
2 answers

Error resolving a NSNetService

I'm creating a board game to be played via wi-fi, in the iPhone. When device A invites device B to play(try to resolve the NSNetService published by B), device B can accept or decline. If B declines, A is notified and everything is fine. But if A…
Fernando
  • 7,785
  • 6
  • 49
  • 81
3
votes
3 answers

NSNetService works fine, but can't get hostName, resolve causes error

I'm using Bonjour with an NSNetService to publish a server from my iPhone. It all works as expected, I can browse the pages I'm serving etc. However, on the iPhone I want to display the host name (i.e. the URL, like "myDevice.local."), so that one…
mkeiser
  • 965
  • 9
  • 17
3
votes
1 answer

How to determine if connection is Bluetooth or WiFi with the iPhone?

I am creating a connection using a bonjour netservice between two iphones. I connect using CFStreamCreatePairWithSocketToHost(kCFAllocatorDefault, (CFStringRef)netService.hostName, netService.port, &readStream, &writeStream); But I can not…
StephenB
  • 41
  • 3
3
votes
0 answers

Airplay error Unknown VADPortStatus: -16612

I've created two bonjour services: _airplay._tcp.local (port 7000) and _raop._tcp.local (port 41952). When I publish these services, they show up in the control center in iOS as expected. However, when I attempt to connect to them the airplay…
Jake
  • 13,097
  • 9
  • 44
  • 73
3
votes
1 answer

Bonjour Service Browser with Swift does not fetch serviceinfo

The service I want to connect to is published via Bonjour. I can find all the info with the Bonjour Browser, however if I try to gather the data programmatically, the only value I get, is the name of the service. The NetService delegate is set and…
Rufus_12
  • 392
  • 1
  • 5
  • 14
3
votes
2 answers

Using NSNetService and NSNetServiceBrowser on a Swift application

I'd like to make an app that is able to discover and connect to peers on the local network, so i've decided to implement it in swift, using the bonjour framework. However, i can't make Bonjour work using Swift, and I can't figure out why. Here is…
jbl
  • 33
  • 1
  • 4
3
votes
1 answer

IPAddress from NSData using Bonjour NSNetService in MonoTouch?

I'm using Xamarin + MonoTouch on iOS to browse for a web server on the network that I can then download files from. The NSNetService that is passed into the resolve event handler contains addresses as NSData. I can't find a good way to turn that…
Jason Champion
  • 2,670
  • 4
  • 35
  • 55
2
votes
2 answers

Sending text message from one iPhone device to another using NSNetServices

I want to send the text message from one iPhone device to another iphone device or simulator using NSNetServices. Can anyone has idea how to figure out this problem?
Mudit Bajpai
  • 3,010
  • 19
  • 34
2
votes
1 answer

how we remove a published service from NSNetService class?

how can i remove a published service from NSNetService class? can any one tell me to do it? or need to get my device name unique at all times(if i done more than one publish)
Vipin
  • 4,718
  • 12
  • 54
  • 81
2
votes
1 answer

How to get Printer URL from NetService

I'm trying to fetch all the local printer by using this way; let serviceBrowser = NetServiceBrowser() serviceBrowser.delegate = self serviceBrowser.schedule(in: .current, forMode: .defaultRunLoopMode) serviceBrowser.searchForServices(ofType:…
serdaryillar
  • 413
  • 5
  • 16