Obtaining Bonjour Address with IP Address and / or Host Name

I am working on an iPhone-iPad with Objective-C. I need to get the Bonjour address of the device. I understand that this address is generated with the host name of the device that I already have.

Can someone help me?

Thanks in advance.

Mikywan.

+3
source share
1 answer

see below

service = [[NSNetService alloc] initWithDomain:@"local." type:@"_music._tcp" name:serviceName];

[service setDelegate:delegateObject];

[service resolveWithTimeout:5.0]; // This code will return an address on delegate method`

The following delegate methods will be run depending on the result

 netServiceDidResolveAddress

   netService:didNotResolve:

See Docs for more details.

+3
source

Source: https://habr.com/ru/post/1793872/


All Articles