net.sbbi.upnp
Class DiscoveryAdvertisement
java.lang.Object
net.sbbi.upnp.DiscoveryAdvertisement
- All Implemented Interfaces:
- Runnable
public class DiscoveryAdvertisement
- extends Object
- implements Runnable
SSDP messages listener Thread, notify registered objects implementing the interface DiscoveryEventHandler
when a device joins the networks or leaves it.
The listener thread is set to only accept matching device description and broadcast message sender IP
to avoid a security flaw with the protocol. If you are not happy with such behaviour
you can set the net.sbbi.upnp.ddos.matchip system property to false to avoid this check.
- Version:
- 1.0
- Author:
- SuperBonBon
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EVENT_SSDP_ALIVE
public static final int EVENT_SSDP_ALIVE
- See Also:
- Constant Field Values
EVENT_SSDP_BYE_BYE
public static final int EVENT_SSDP_BYE_BYE
- See Also:
- Constant Field Values
getInstance
public static final DiscoveryAdvertisement getInstance()
setDaemon
public void setDaemon(boolean daemon)
registerEvent
public void registerEvent(int notificationEvent,
String nt,
DiscoveryEventHandler eventHandler)
throws IOException
- Registers an event category sent by UPNP devices
- Parameters:
notificationEvent - the event type, either DiscoveryAdvertisement.EVENT_SSDP_ALIVE
or DiscoveryAdvertisement.EVENT_SSDP_BYE_BYEnt - the type of device advertisement, upnp:rootdevice will return you all advertisement in relation with nt upnp:rootdevice
a null value specify that all nt type are wantedeventHandler - the events handler, this objet will receive notifications..
- Throws:
IOException - if an error ocurs when the SSDP events listeners threads starts
unRegisterEvent
public void unRegisterEvent(int notificationEvent,
String nt,
DiscoveryEventHandler eventHandler)
- Unregisters an event category sent by UPNP devices
- Parameters:
notificationEvent - the event type, either DiscoveryAdvertisement.EVENT_SSDP_ALIVE
or DiscoveryAdvertisement.EVENT_SSDP_BYE_BYEnt - the type of device advertisement, upnp:rootdevice will unregister all advertisement in relation with nt upnp:rootdevice
a null value specify that all nt type are unregisteredeventHandler - the events handler that needs to be unregistred.
run
public void run()
- Specified by:
run in interface Runnable
Copyright © 2010. All Rights Reserved.