当前位置: 首页>>代码示例>>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;未经允许,请勿转载。