当前位置: 首页>>代码示例>>Java>>正文


Java NetworkTopologyEvent类代码示例

本文整理汇总了Java中javax.jmdns.NetworkTopologyEvent的典型用法代码示例。如果您正苦于以下问题:Java NetworkTopologyEvent类的具体用法?Java NetworkTopologyEvent怎么用?Java NetworkTopologyEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NetworkTopologyEvent类属于javax.jmdns包,在下文中一共展示了NetworkTopologyEvent类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: inetAddressRemoved

import javax.jmdns.NetworkTopologyEvent; //导入依赖的package包/类
@Override
public void inetAddressRemoved(NetworkTopologyEvent event) {
    String event_address_str = event.getInetAddress().getHostAddress();
    // can't get the display name like above, as the interface is no longer available.
    // if we really want the display name, need to store it somewhere when the network interface
    // is added.
    logger.println("[-] NetworkInterface: " + event_address_str);
    // Trigger service info callbacks - this is fairly brutal. It might be better to
    // check here if that service is no longer supplied on all interfaces, then call
    // serviceRemoved. If it is still supplied, provide a serviceResolved callback with
    // the updated addresses.

    event.getDNS().removeServiceTypeListener(this);
    for(String listener : listeners ) {
        logger.println("      Removing service listener '" + listener + "'");
        event.getDNS().removeServiceListener(listener, this);
    }
    for (ServiceInfo service : services ) {
        logger.println("Unpublishing Service:");
        logger.println("  Name   : " + service.getName() );
        logger.println("  Type   : " + service.getType() );
        logger.println("  Port   : " + service.getPort() );
        event.getDNS().unregisterService(service); // this may not work because we're cloning it.
    }
}
 
开发者ID:rosalfred,项目名称:smarthome_network_zeroconf,代码行数:26,代码来源:Zeroconf.java

示例2: inetAddressRemoved

import javax.jmdns.NetworkTopologyEvent; //导入依赖的package包/类
@Override
public void inetAddressRemoved(NetworkTopologyEvent event) {
    InetAddress address = event.getInetAddress();
    try {
        synchronized (this) {
            if (_knownMDNS.containsKey(address)) {
                JmDNS mDNS = _knownMDNS.remove(address);
                mDNS.close();
                final NetworkTopologyEvent jmdnsEvent = new NetworkTopologyEventImpl(mDNS, address);
                for (final NetworkTopologyListener listener : this.networkListeners()) {
                    _ListenerExecutor.submit(new Runnable() {
                        /**
                         * {@inheritDoc}
                         */
                        @Override
                        public void run() {
                            listener.inetAddressRemoved(jmdnsEvent);
                        }
                    });
                }
            }
        }
    } catch (Exception e) {
        logger.warning("Unexpected unhandled exception: " + e);
    }
}
 
开发者ID:iilxy,项目名称:AndroidmDNS,代码行数:27,代码来源:JmmDNSImpl.java

示例3: inetAddressAdded

import javax.jmdns.NetworkTopologyEvent; //导入依赖的package包/类
@Override
public void inetAddressAdded(NetworkTopologyEvent event) {
    InetAddress address = event.getInetAddress();
    try {
        synchronized (this) {
            if (!_knownMDNS.containsKey(address)) {
                _knownMDNS.put(address, JmDNS.create(address));
                final NetworkTopologyEvent jmdnsEvent = new NetworkTopologyEventImpl(_knownMDNS.get(address), address);
                for (final NetworkTopologyListener listener : this.networkListeners()) {
                    _ListenerExecutor.submit(new Runnable() {
                        /**
                         * {@inheritDoc}
                         */
                        @Override
                        public void run() {
                            listener.inetAddressAdded(jmdnsEvent);
                        }
                    });
                }
            }
        }
    } catch (Exception e) {
        logger.warning("Unexpected unhandled exception: " + e);
    }
}
 
开发者ID:DeviceConnect,项目名称:DeviceConnect-Android,代码行数:26,代码来源:JmmDNSImpl.java

示例4: inetAddressRemoved

import javax.jmdns.NetworkTopologyEvent; //导入依赖的package包/类
@Override
public void inetAddressRemoved(NetworkTopologyEvent event) {
    InetAddress address = event.getInetAddress();
    try {
        if (_knownMDNS.containsKey(address)) {
            synchronized (_knownMDNS) {
                if (_knownMDNS.containsKey(address)) {
                    JmDNS mDNS = _knownMDNS.remove(address);
                    mDNS.close();
                    final NetworkTopologyEvent jmdnsEvent = new NetworkTopologyEventImpl(mDNS, address);
                    for (final NetworkTopologyListener listener : this.networkListeners()) {
                        _listenerExecutor.submit(new Runnable() {
                            /**
                             * {@inheritDoc}
                             */
                            @Override
                            public void run() {
                                listener.inetAddressRemoved(jmdnsEvent);
                            }
                        });
                    }
                }
            }
        }
    } catch (Exception e) {
        logger.warning("Unexpected unhandled exception: " + e);
    }
}
 
开发者ID:JMRI,项目名称:EngineDriver,代码行数:29,代码来源:JmmDNSImpl.java

示例5: inetAddressAdded

import javax.jmdns.NetworkTopologyEvent; //导入依赖的package包/类
@Override
public void inetAddressAdded(NetworkTopologyEvent event)
{
    InetAddress address = event.getInetAddress();
    try
    {
        synchronized (this)
        {
            if (!_knownMDNS.containsKey(address))
            {
                JmDNS mDNS = JmDNS.create(address);
                _knownMDNS.put(address, mDNS);
                final NetworkTopologyEvent jmdnsEvent = new NetworkTopologyEventImpl(mDNS, address);
                for (final NetworkTopologyListener listener : this.networkListeners())
                {
                    _ListenerExecutor.submit(new Runnable() {
                        /**
                         * {@inheritDoc}
                         */
                        @Override
                        public void run()
                        {
                            listener.inetAddressAdded(jmdnsEvent);
                        }
                    });
                }
            }
        }
    }
    catch (Exception e)
    {
        logger.warning("Unexpected unhandled exception: " + e);
    }
}
 
开发者ID:blackshadowwalker,项目名称:log4j-collector,代码行数:35,代码来源:JmmDNSImpl.java

示例6: inetAddressRemoved

import javax.jmdns.NetworkTopologyEvent; //导入依赖的package包/类
@Override
public void inetAddressRemoved(NetworkTopologyEvent event)
{
    InetAddress address = event.getInetAddress();
    try
    {
        synchronized (this)
        {
            if (_knownMDNS.containsKey(address))
            {
                JmDNS mDNS = JmDNS.create(address);
                _knownMDNS.remove(address);
                mDNS.close();
                final NetworkTopologyEvent jmdnsEvent = new NetworkTopologyEventImpl(mDNS, address);
                for (final NetworkTopologyListener listener : this.networkListeners())
                {
                    _ListenerExecutor.submit(new Runnable() {
                        /**
                         * {@inheritDoc}
                         */
                        @Override
                        public void run()
                        {
                            listener.inetAddressRemoved(jmdnsEvent);
                        }
                    });
                }
            }
        }
    }
    catch (Exception e)
    {
        logger.warning("Unexpected unhandled exception: " + e);
    }
}
 
开发者ID:blackshadowwalker,项目名称:log4j-collector,代码行数:36,代码来源:JmmDNSImpl.java


注:本文中的javax.jmdns.NetworkTopologyEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。