本文整理汇总了Java中javax.jmdns.NetworkTopologyDiscovery类的典型用法代码示例。如果您正苦于以下问题:Java NetworkTopologyDiscovery类的具体用法?Java NetworkTopologyDiscovery怎么用?Java NetworkTopologyDiscovery使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NetworkTopologyDiscovery类属于javax.jmdns包,在下文中一共展示了NetworkTopologyDiscovery类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: JmmDNSImpl
import javax.jmdns.NetworkTopologyDiscovery; //导入依赖的package包/类
/**
*
*/
public JmmDNSImpl() {
super();
_networkListeners = Collections.synchronizedSet(new HashSet<NetworkTopologyListener>());
_knownMDNS = new ConcurrentHashMap<InetAddress, JmDNS>();
_services = new ConcurrentHashMap<String, ServiceInfo>(20);
_ListenerExecutor = Executors.newSingleThreadExecutor();
_jmDNSExecutor = Executors.newCachedThreadPool();
_timer = new Timer("Multihommed mDNS.Timer", true);
_serviceListeners = new ConcurrentHashMap<String, List<ServiceListener>>();
_typeListeners = Collections.synchronizedSet(new HashSet<ServiceTypeListener>());
_serviceTypes = Collections.synchronizedSet(new HashSet<String>());
(new NetworkChecker(this, NetworkTopologyDiscovery.Factory.getInstance())).start(_timer);
_isClosing = new AtomicBoolean(false);
_closed = new AtomicBoolean(false);
}
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:19,代码来源:JmmDNSImpl.java
示例2: JmmDNSImpl
import javax.jmdns.NetworkTopologyDiscovery; //导入依赖的package包/类
/**
*
*/
public JmmDNSImpl() {
super();
_networkListeners = Collections.synchronizedSet(new HashSet<NetworkTopologyListener>());
_knownMDNS = new ConcurrentHashMap<InetAddress, JmDNS>();
_services = new ConcurrentHashMap<String, ServiceInfo>(20);
_listenerExecutor = Executors.newSingleThreadExecutor(new NamedThreadFactory("JmmDNS Listeners"));
_jmDNSExecutor = Executors.newCachedThreadPool(new NamedThreadFactory("JmmDNS"));
_timer = new Timer("Multihomed mDNS.Timer", true);
_serviceListeners = new ConcurrentHashMap<String, List<ServiceListener>>();
_typeListeners = Collections.synchronizedSet(new HashSet<ServiceTypeListener>());
_serviceTypes = Collections.synchronizedSet(new HashSet<String>());
(new NetworkChecker(this, NetworkTopologyDiscovery.Factory.getInstance())).start(_timer);
_isClosing = new AtomicBoolean(false);
_closed = new AtomicBoolean(false);
}
开发者ID:JMRI,项目名称:EngineDriver,代码行数:19,代码来源:JmmDNSImpl.java
示例3: JmmDNSImpl
import javax.jmdns.NetworkTopologyDiscovery; //导入依赖的package包/类
/**
*
*/
public JmmDNSImpl() {
super();
_networkListeners = Collections.synchronizedSet(new HashSet<NetworkTopologyListener>());
_knownMDNS = new ConcurrentHashMap<InetAddress, JmDNS>();
_services = new ConcurrentHashMap<String, ServiceInfo>(20);
_ListenerExecutor = Executors.newSingleThreadExecutor();
_jmDNSExecutor = Executors.newCachedThreadPool();
_timer = new Timer("Multihommed mDNS.Timer", true);
(new NetworkChecker(this, NetworkTopologyDiscovery.Factory.getInstance())).start(_timer);
}
开发者ID:DeviceConnect,项目名称:DeviceConnect-Android,代码行数:14,代码来源:JmmDNSImpl.java
示例4: newHostInfo
import javax.jmdns.NetworkTopologyDiscovery; //导入依赖的package包/类
/**
* @param address
* IP address to bind
* @param dns
* JmDNS instance
* @param jmdnsName
* JmDNS name
* @return new HostInfo
*/
public static HostInfo newHostInfo(InetAddress address, JmDNSImpl dns, String jmdnsName) {
HostInfo localhost = null;
String aName = (jmdnsName != null ? jmdnsName : "");
InetAddress addr = address;
try {
if (addr == null) {
String ip = System.getProperty("net.mdns.interface");
if (ip != null) {
addr = InetAddress.getByName(ip);
} else {
addr = InetAddress.getLocalHost();
if (addr.isLoopbackAddress()) {
// Find local address that isn't a loopback address
InetAddress[] addresses = NetworkTopologyDiscovery.Factory.getInstance().getInetAddresses();
if (addresses.length > 0) {
addr = addresses[0];
}
}
}
if (addr.isLoopbackAddress()) {
logger.warning("Could not find any address beside the loopback.");
}
}
if (aName.length() == 0) {
aName = addr.getHostName();
}
if (aName.contains("in-addr.arpa") || (aName.equals(addr.getHostAddress()))) {
aName = ((jmdnsName != null) && (jmdnsName.length() > 0) ? jmdnsName : addr.getHostAddress());
}
} catch (final IOException e) {
logger.log(Level.WARNING, "Could not intialize the host network interface on " + address + "because of an error: " + e.getMessage(), e);
// This is only used for running unit test on Debian / Ubuntu
addr = loopbackAddress();
aName = ((jmdnsName != null) && (jmdnsName.length() > 0) ? jmdnsName : "computer");
}
// A host name with "." is illegal. so strip off everything and append .local.
// We also need to be carefull that the .local may already be there
int index = aName.indexOf(".local");
if (index > 0) {
aName = aName.substring(0, index);
}
aName = aName.replace('.', '-');
aName += ".local.";
localhost = new HostInfo(addr, aName, dns);
return localhost;
}
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:56,代码来源:HostInfo.java
示例5: NetworkChecker
import javax.jmdns.NetworkTopologyDiscovery; //导入依赖的package包/类
public NetworkChecker(NetworkTopologyListener mmDNS, NetworkTopologyDiscovery topology) {
super();
this._mmDNS = mmDNS;
this._topology = topology;
_knownAddresses = Collections.synchronizedSet(new HashSet<InetAddress>());
}
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:7,代码来源:JmmDNSImpl.java
示例6: newHostInfo
import javax.jmdns.NetworkTopologyDiscovery; //导入依赖的package包/类
/**
* @param address
* IP address to bind
* @param dns
* JmDNS instance
* @param jmdnsName
* JmDNS name
* @return new HostInfo
*/
public static HostInfo newHostInfo(InetAddress address, JmDNSImpl dns, String jmdnsName) {
Log.i("mDNS","newHostInfo");
HostInfo localhost = null;
String aName = "";
InetAddress addr = address;
Log.i("mDNS","addr:"+addr);
try {
if (addr == null) {
String ip = System.getProperty("net.mdns.interface");
Log.i("mDNS","ip"+ip);
if (ip != null) {
addr = InetAddress.getByName(ip);
} else {
addr = InetAddress.getLocalHost();
Log.i("mDNS","addr:"+addr);
if (addr.isLoopbackAddress()) {
// Find local address that isn't a loopback address
InetAddress[] addresses = NetworkTopologyDiscovery.Factory.getInstance().getInetAddresses();
if (addresses.length > 0) {
addr = addresses[0];
}
}
}
aName = addr.getHostName();
if (addr.isLoopbackAddress()) {
logger.warning("Could not find any address beside the loopback.");
}
} else {
aName = addr.getHostName();
}
if (aName.contains("in-addr.arpa") || (aName.equals(addr.getHostAddress()))) {
aName = ((jmdnsName != null) && (jmdnsName.length() > 0) ? jmdnsName : addr.getHostAddress());
}
} catch (final IOException e) {
logger.log(Level.WARNING, "Could not intialize the host network interface on " + address + "because of an error: " + e.getMessage(), e);
// This is only used for running unit test on Debian / Ubuntu
addr = loopbackAddress();
aName = ((jmdnsName != null) && (jmdnsName.length() > 0) ? jmdnsName : "computer");
}
// A host name with "." is illegal. so strip off everything and append .local.
aName = aName.replace('.', '-');
aName += ".local.";
localhost = new HostInfo(addr, aName, dns);
return localhost;
}
开发者ID:DeviceConnect,项目名称:DeviceConnect-Android,代码行数:61,代码来源:HostInfo.java
示例7: newHostInfo
import javax.jmdns.NetworkTopologyDiscovery; //导入依赖的package包/类
/**
* @param address
* IP address to bind
* @param dns
* JmDNS instance
* @param jmdnsName
* JmDNS name
* @return new HostInfo
*/
public static HostInfo newHostInfo(InetAddress address, JmDNSImpl dns, String jmdnsName) {
HostInfo localhost = null;
String aName = "";
InetAddress addr = address;
try {
if (addr == null) {
String ip = System.getProperty("net.mdns.interface");
if (ip != null) {
addr = InetAddress.getByName(ip);
} else {
addr = InetAddress.getLocalHost();
if (addr.isLoopbackAddress()) {
// Find local address that isn't a loopback address
InetAddress[] addresses = NetworkTopologyDiscovery.Factory.getInstance().getInetAddresses();
if (addresses.length > 0) {
addr = addresses[0];
}
}
}
aName = addr.getHostName();
if (addr.isLoopbackAddress()) {
logger.warning("Could not find any address beside the loopback.");
}
} else {
aName = addr.getHostName();
}
if (aName.contains("in-addr.arpa") || (aName.equals(addr.getHostAddress()))) {
aName = ((jmdnsName != null) && (jmdnsName.length() > 0) ? jmdnsName : addr.getHostAddress());
}
} catch (final IOException e) {
logger.log(Level.WARNING, "Could not intialize the host network interface on " + address + "because of an error: " + e.getMessage(), e);
// This is only used for running unit test on Debian / Ubuntu
addr = loopbackAddress();
aName = ((jmdnsName != null) && (jmdnsName.length() > 0) ? jmdnsName : "computer");
}
// A host name with "." is illegal. so strip off everything and append .local.
aName = aName.replace('.', '-');
aName += ".local.";
localhost = new HostInfo(addr, aName, dns);
return localhost;
}
开发者ID:w-shackleton,项目名称:droidpad-android,代码行数:51,代码来源:HostInfo.java
示例8: newHostInfo
import javax.jmdns.NetworkTopologyDiscovery; //导入依赖的package包/类
/**
* @param address
* IP address to bind
* @param dns
* JmDNS instance
* @param jmdnsName
* JmDNS name
* @return new HostInfo
*/
public static HostInfo newHostInfo(final InetAddress address, final JmDNSImpl dns, final String jmdnsName) {
HostInfo localhost = null;
String aName = "";
InetAddress addr = address;
try {
if (addr == null) {
final String ip = System.getProperty("net.mdns.interface");
if (ip != null) {
addr = InetAddress.getByName(ip);
} else {
addr = InetAddress.getLocalHost();
if (addr.isLoopbackAddress()) {
// Find local address that isn't a loopback address
final InetAddress[] addresses = NetworkTopologyDiscovery.Factory.getInstance().getInetAddresses();
if (addresses.length > 0) {
addr = addresses[0];
}
}
}
aName = (jmdnsName != null && jmdnsName.length() > 0) ? jmdnsName : addr.getHostName();
if (addr.isLoopbackAddress()) {
logger.warning("Could not find any address beside the loopback.");
}
} else {
aName = (jmdnsName != null && jmdnsName.length() > 0) ? jmdnsName : addr.getHostName();
}
if (aName.contains("in-addr.arpa") || (aName.equals(addr.getHostAddress()))) {
aName = (jmdnsName != null && jmdnsName.length() > 0) ? jmdnsName : addr.getHostAddress();
}
} catch (final IOException e) {
logger.log(Level.WARNING, "Could not intialize the host network interface on " + address + "because of an error: " + e.getMessage(), e);
// This is only used for running unit test on Debian / Ubuntu
addr = loopbackAddress();
aName = (jmdnsName != null && jmdnsName.length() > 0) ? jmdnsName : "computer";
}
// A host name with "." is illegal. so strip off everything and append .local.
aName = aName.replace('.', '-');
aName += ".local.";
localhost = new HostInfo(addr, aName, dns);
return localhost;
}
开发者ID:mwaylabs,项目名称:JmDNS,代码行数:51,代码来源:HostInfo.java
注:本文中的javax.jmdns.NetworkTopologyDiscovery类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论