簡體   English   中英

使用IP地址和/或主機名獲取Bonjour地址

[英]Getting Bonjour Address with IP Address and/or Host Name

我正在使用Objective-C開發iPhone-iPad應用程序。 我需要獲取設備的Bonjour地址。 我知道這個地址是使用我已經擁有的設備的主機名生成的。

有人能幫助我嗎?

提前致謝。

Mikywan。

見下面

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`

以下委托方法將根據結果觸發

 netServiceDidResolveAddress

   netService:didNotResolve:

有關詳細說明,請參閱文檔

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM