當前位置: 首頁>>代碼示例>>Java>>正文


Java ServiceInfo.getInetAddresses方法代碼示例

本文整理匯總了Java中javax.jmdns.ServiceInfo.getInetAddresses方法的典型用法代碼示例。如果您正苦於以下問題:Java ServiceInfo.getInetAddresses方法的具體用法?Java ServiceInfo.getInetAddresses怎麽用?Java ServiceInfo.getInetAddresses使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.jmdns.ServiceInfo的用法示例。


在下文中一共展示了ServiceInfo.getInetAddresses方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: serviceResolved

import javax.jmdns.ServiceInfo; //導入方法依賴的package包/類
@Override
/**
 * This implements service resolved in a very simple way. If the user has callbacks, then
 * it just directly resolves the service info to a ros service info. Note that if you have
 * multiple interfaces (e.g. eth0, wlan0) then this won't provide the resolved artifact
 * for all interfaces. It might be worth adding a check for that service across all
 * interfaces here and providing a fully updated (with regards to addresses) ros
 * service info artifact to the user's callback here.
 */
public void serviceResolved(ServiceEvent event) {
    final ServiceInfo service_info = event.getInfo();
    ZeroconfDiscoveryHandler callback = listener_callbacks.get(service_info.getType());
    if ( callback != null ) {
        callback.serviceResolved(toDiscoveredService(service_info));
    } else {
        logger.println("[=] Resolved        : " + service_info.getQualifiedName());
        logger.println("      Port          : " + service_info.getPort() );
        for ( int i = 0; i < service_info.getInetAddresses().length; ++i ) {
            logger.println("      Address       : " + service_info.getInetAddresses()[i].getHostAddress() );
        }
    }
}
 
開發者ID:rosalfred,項目名稱:smarthome_network_zeroconf,代碼行數:23,代碼來源:Zeroconf.java

示例2: onDiscoveredService

import javax.jmdns.ServiceInfo; //導入方法依賴的package包/類
private void onDiscoveredService(final ServiceInfo info) {
	if (info.getInetAddresses() == null) {
		return;
	}
	final WlanAddress address = new WlanAddress(this.dispatcher, info.getInetAddresses()[0], info.getPort());
	this.addresses.put(info.getName(), address);
	
	this.executor.execute(new Runnable() {
		public void run() {
			WlanBrowser.this.handler.onAddressDiscovered(WlanBrowser.this, address, UUID.fromString(info.getName()));
		}
	});
}
 
開發者ID:ls1intum,項目名稱:jReto,代碼行數:14,代碼來源:WlanBrowser.java


注:本文中的javax.jmdns.ServiceInfo.getInetAddresses方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。