java.lang.Object
org.cybergarage.upnp.ssdp.HTTPMUSocket
org.cybergarage.upnp.ssdp.SSDPNotifySocket
- All Implemented Interfaces:
Runnable
This class identifies a SSDP socket only for notifying packet.
Constructor Summary
ConstructorsConstructorDescriptionSSDPNotifySocket(String bindAddr) Opens a notification socket bound to one local address.Method Summary
All MethodsModifier and TypeMethodDescriptionGets the attached control point.booleanpost(SSDPNotifyRequest req) This method send aSSDPNotifyRequestoverSSDPNotifySocketvoidrun()Receives multicast notifications and forwards them to the control point.voidsetControlPoint(ControlPoint ctrlp) Attaches the control point that receives notifications from this socket.voidstart()Starts the thread that receives notifications on this socket.voidstop()Stops the receiving thread and closes the socket.Methods inherited from class HTTPMUSocket
close, finalize, getLocalAddress, getLocalPort, getMulticastAddress, getMulticastInetAddress, getMulticastPort, getSocket, open, open, post, post, receive, send, send, toStringModifier and TypeMethodDescriptionbooleanclose()Close the multicast socket and leave the group.protected voidfinalize()Get the local address.intGet the source port for multicast packet.Get the multicast address string.Get the multicast inet address.intGet the destination port for multicast packet.Get the opened multicast socket.booleanOpen a multicast socket with the given string address.booleanopen(String addr, int port, InetAddress bindAddr) Open a multicast socket and join the given group.booleanpost(HTTPRequest req) Post an HTTP request using default bind settings.booleanpost(HTTPRequest req, String bindAddr, int bindPort) Post an HTTP request as a multicast message.receive()Receive a multicast packet.booleanSend a multicast message using default bind settings.booleanSend a multicast message.toString()I2P
Constructor Details
SSDPNotifySocket
Opens a notification socket bound to one local address.- Parameters:
bindAddr- the local address the socket is bound to, which also decides whether an IPv4 or IPv6 multicast group is joined- Throws:
IOException- if the socket cannot be bound to the given address
Method Details
setControlPoint
Attaches the control point that receives notifications from this socket.- Parameters:
ctrlp- the control point that should receive the notifications sent through this socket, or null to detach the current one
getControlPoint
Gets the attached control point.- Returns:
- the control point set by setControlPoint, or null if none is set
post
This method send aSSDPNotifyRequestoverSSDPNotifySocket- Parameters:
req- theSSDPNotifyRequestto send- Returns:
- true if and only if the transmission succeeded
Because it rely on UDP doesn't mean that it's also received
run
start
public void start()Starts the thread that receives notifications on this socket.stop
public void stop()Stops the receiving thread and closes the socket.