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
2
votes
2 answers

Using NSNetService class to make an SMB tcp ip connection to a folder shared on windows machine

I have been trying to figure out a way to access my windows shared folder using iPhone. The desired functionality is part of bigger enterprise app I am building. Here is someone who has already asked a similar question but no luck - Does iOS support…
smile.al.d.way
  • 361
  • 5
  • 17
2
votes
1 answer

Unsafepointer adjustment for Swift 4

I have not found a solution how i can adjust the following lines (error) to Swift 4. Regarding to documents, withUnsafePointer method should be used but i could not find a way to add addressBytes.bytes into code. func netServiceDidResolveAddress(_…
Sunrise17
  • 379
  • 3
  • 18
2
votes
1 answer

NSNetService Bonjour Mimicking iPhoto

I am trying to mimic iPhoto sharing and have gotten as far as publishing the service using the iPhoto service name "_dpap._tcp.". iPhoto sees my bogus "share", but it is grayed out. I'm watching network traffic to see if iPhoto is looking for…
Matt Long
  • 24,438
  • 4
  • 73
  • 99
2
votes
2 answers

NSNetservice did not get netServiceDidPublish delegate call

what I want to do is enable a simple bonjour service on my ipod touch. And after I publish my custom bonjour service, the delegator did not get "netServiceDidPublish:" call. I also check there is not any error message from "netService:(NSNetService…
dokinkon
  • 83
  • 2
  • 8
2
votes
0 answers

CocoaAsyncSocket and True iOS Peer-to-Peer file transfer through NSNetService's includePeerToPeer setting

I'm trying to create an application that has the ability to transfer large files between iOS devices through what I'll call a "true" peer-to-peer network ie two devices connected directly to each other without an intermediate router / wi-fi network.…
user3062913
  • 353
  • 2
  • 10
2
votes
1 answer

Swift IP Address from NSNetService

I am able to get the IP Address from NSNetService using Objective-C code in my Swift project. Is there Swift code that can do the same (to avoid having a bridging header)? Otherwise I'll keep the way I'm doing it now - but hoping it can be done in…
2
votes
1 answer

Understanding “includesPeerToPeer” property of NSNetservice

I am developing a 3D Wi-Fi multiplayer game for iPhone and iPad without using any game engine. I have taken reference of the “WiTap” sample for device connectivity for local Wi-Fi multiplayer game (Link to the sample code:WiTap). I found that there…
2
votes
2 answers

Send AppleScript to remote computer in Objective-C

How do you use Objective-C (iPhone) to send an AppleScript to a remote computer (on same network) to be executed? I think something like NSNetService would be of use here, but I don't know. EDIT: Ok, to clarify, all I want to do is send a command ID…
Mark Szymanski
  • 56,590
  • 24
  • 70
  • 87
2
votes
1 answer

If NSNetService name method is deprecated in iOS 7.x, how do I find the name of the service?

The current documentation for NSNetService states that the 'name' is deprecated after iOS 6.1 Since that is the case, how do I find the name of a service which has been discovered with an NSNetServiceBrowser? NSNetServiceBrowser calls the delegate…
Kenny
  • 1,083
  • 2
  • 8
  • 23
2
votes
1 answer

Connect To a Bonjour Service with IP address

While I know Bonjour is used so that we don't get our hands messy with IPAddresses, but I need to write an app that can "manually add a new service by specifying the IPAddress". According to the docs, one can do that by creating a connection by…
user1349663
  • 595
  • 1
  • 7
  • 21
2
votes
1 answer

How to list all shared devices on local WiFi/LAN Network?

I want to list all shared devices name which is available on that network by which i use on my device. So that i can know who is using the same internet network. After googling i found that using Bonjor i can do it. I use NSNetService class to…
Surjeet Singh
  • 11,691
  • 2
  • 37
  • 54
2
votes
2 answers

NSNetServiceBrowser does not find Service

I tried to write a Client(iPad)/Server(iMac) application based on the CocoaEcho example. My first simple example worked, but after adding more functionality the client is unable to find the server. After starting the server, I start the client, both…
2
votes
0 answers

NSNetServiceBrowser issues on iOS - not detecting all changes

I think this may be an iOS bug. I run the following simple code, to broadcast a net service: self.netService = [[NSNetService alloc] initWithDomain:@"local." type:@"_testnetwork._tcp." …
Andrew
  • 15,935
  • 28
  • 121
  • 203
2
votes
2 answers

iOS take messages between service and client with DNSServiceBrowse and DNSServiceBrowse

I am trying to implement a conversation with iPhone/iPad devices using DNSServiceRegister to register devices and DNSServiceBrowse to find services and resolve. How can I send messages between the 'client' and the service? there is any listener that…
2
votes
2 answers

NSNetService's TXTRecordData nil after resolution

So, here is my problem: My iOS app is advertising an NSNetService over the local network, service discovery is working good. I also know that I need to resolve my service before I am able to read it's TXTRecordData. In the service's -didPublish…
Dario
  • 31
  • 4