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
1
vote
1 answer

How to use getInputStream() on NSNetService in Swift?

I’m trying to set up an NSInputStream and NSOutputStream for a Bonjour connection on a NSNetService. The getInputStream method requires arguments of the type UnsafeMutablePointer: public func getInputStream(inputStream:…
Marijn
  • 1,439
  • 12
  • 12
1
vote
1 answer

iOS: How to keep TCP socket and the NSNetService working when the App is in the background

I'm doing a P2P VoIP application using GCDAsyncSocket, GCDAsyncUdpSocket and NSNetService to find other devices with the application on the network. I have a TCP socket to transfer user data and negotiate the UDP connection. I need to keep the…
1
vote
1 answer

Getting the HostName of a Remote iOS Device with NSNetService

After more than a few hours of searching, I got in what looks like a dead end. In this case, all that I am trying to do, is to get all the iOS Devices of the network with Bonjour. I did so like this self.serviceBrowser = [[NSNetServiceBrowser alloc]…
isklikas
  • 190
  • 2
  • 16
1
vote
3 answers

Is this an IP address?

I am using NSNetService class to resolve IP addresses using MDNS discovery. I get two results: Something that looks like this: ae60::x:1cdf:x:212 (where x is another value similar to the others) And the classic ip address, like: 10.x.x.2 Is the…
mm24
  • 9,280
  • 12
  • 75
  • 170
1
vote
1 answer

How to get NSNetService inform when a client disconnects?

I'm kinda new to Objective-C / Cocoa, and I'm trying to write a bonjour server-client app. Because I don't have much experience, I would appreciate if your replies could also include explanations on how to do it, and not just the code. I manage to…
AMI289
  • 1,098
  • 9
  • 10
1
vote
2 answers

How to sync iPhone and Mac CoreData objects through bonjour?

I know similar questions have been asked before. I'm using the Sync Demo app I found online here, which uses Picture Sharing as a guide. I've integrated it into my desktop and iphone apps and have the connection working, but am clueless as to how to…
monotreme
  • 582
  • 1
  • 6
  • 20
1
vote
3 answers

How does didAcceptConnectionWithInputStream:outputStream: get called?

My first question is how do I get the didAcceptConnectionWithInputStream:outputStream: callback in NSNetServiceDelegate to get called? Follow up question: can I still establish a connection between a client and server, although I never get a…
Sheamus
  • 6,506
  • 3
  • 35
  • 61
1
vote
1 answer

NSNetService NSNetServiceListenForConnections use and checking for availability?

I'm creating an application that uses NSNetService to publish a server, and I've come across the NSNetServiceListenForConnections option that can be used in OS X 10.9 with the publishWithOptions: method. This new options is highlighted in the…
Joseph Duffy
  • 4,566
  • 9
  • 38
  • 68
1
vote
1 answer

Resolving NSNetService on server side

I have the problem in resolving NSNetService. i have successfully resolved NSNetService when NSNetServiceBrowser find that service. -(void)netServiceBrowser:(NSNetServiceBrowser *)aNetServiceBrowser didFindService:(NSNetService *)aNetService…
Avi
  • 36
  • 5
1
vote
1 answer

How to check if NSNetService has stopped publishing

I need to find a way to observe when my app stops publishing the service via bonjour. This happens usually when the device receives a call or some such interruption. Background: I'm using GCDAsyncSocket to communicate between 2 devices in the same…
srik
  • 1,447
  • 2
  • 20
  • 33
1
vote
1 answer

iPhone iOS how to publish a UDP service?

I'm modifying the "Chatty" app from here: http://mobileorchard.com/tutorial-networking-and-bonjour-on-iphone/ I'm trying to create a server which quickly receives information from multiple clients, but does not really send anything back. There are…
Alex Stone
  • 46,408
  • 55
  • 231
  • 407
1
vote
1 answer

How to measure the distance between devices through Bonjour?

I'm trying to send data between two devices in bluetooth working area. Since bluetooth can't send files, I want to check whether the device is in bluetooth active area, and if so, send it a file through wi-fi. I tried to use GameKit, but it doesn't…
Riddick
  • 375
  • 4
  • 14
1
vote
2 answers

About delegate and XMLParser iPhone

I am absolutely new to MAC and iPhone. I am going to develop an application that performs a connection to a webservice server that contains some movie files to open it. Does anyone give me some instruction to study or guide me how to develop it. Now…
1
vote
0 answers

Why can't I connect to an apple _apple-midi._udp. NetService using NSNetService?

I am receiving an error when opening an inputstream on an apple published bonjour netservice, _apple-midi._udp. I get the following error: Error Domain=NSPOSIXErrorDomain Code=61 "The operation couldn’t be completed. Connection refused"…
kernelK
  • 189
  • 1
  • 3
  • 14
0
votes
1 answer

NSNetService delegate and ARC

Performing the following in my app won't call the delegate: NSNetService * bonjourMonitor; bonjourMonitor = [[NSNetService alloc] initWithDomain:@"local." type:@"_device-info._tcp" name:@"My Mac"]; [bonjourMonitor setDelegate:self]; …
Daniel
  • 1,473
  • 3
  • 33
  • 63