public class HTTPMUSocket extends Object
This class provides multicast socket functionality specifically designed for SSDP operations in UPnP networks. It handles both sending and receiving multicast UDP packets for device discovery and advertisement.
Key features:
This class is used by SSDP components to send multicast discovery messages and receive multicast advertisements from UPnP devices, enabling the core device discovery functionality in UPnP networks.
| Constructor and Description |
|---|
HTTPMUSocket()Default constructor. |
HTTPMUSocket(String addr,
int port,
String bindAddr)Create a new HTTPMU socket and open it. |
| Modifier and Type | Method and Description |
|---|---|
boolean | close()Close the multicast socket and leave the group. |
protected void | finalize() |
String | getLocalAddress()Get the local address. |
int | getLocalPort()Get the source port for multicast packet. |
String | getMulticastAddress()Get the multicast address string. |
InetAddress | getMulticastInetAddress()Get the multicast inet address. |
int | getMulticastPort()Get the destination port for multicast packet. |
MulticastSocket | getSocket()Get the opened multicast socket. |
boolean | open(String addr,
int port,
InetAddress bindAddr)Open a multicast socket and join the given group. |
boolean | open(String addr,
int port,
String bindAddr)Open a multicast socket with the given string address. |
boolean | post(HTTPRequest req)Post an HTTP request using default bind settings. |
boolean | post(HTTPRequest req,
String bindAddr,
int bindPort)Post an HTTP request as a multicast message. |
SSDPPacket | receive()Receive a multicast packet. |
boolean | send(String msg)Send a multicast message using default bind settings. |
boolean | send(String msg,
String bindAddr,
int bindPort)Send a multicast message. |
String | toString()I2P |
public boolean close()
public String getLocalAddress()
public int getLocalPort()
public String getMulticastAddress()
public InetAddress getMulticastInetAddress()
public int getMulticastPort()
public MulticastSocket getSocket()
MulticastSocketpublic boolean open(String addr, int port, InetAddress bindAddr)
addr - String rappresenting the multicast hostname to join into.port - int rappresenting the port to be use poth as source and destinationbindAddr - InetAddress which identify the hostname of the interface to use for
sending and recieving multicast packetpublic boolean open(String addr, int port, String bindAddr)
addr - the multicast addressport - the portbindAddr - the bind address stringpublic boolean post(HTTPRequest req)
req - the HTTP requestpublic boolean post(HTTPRequest req, String bindAddr, int bindPort)
req - the HTTP requestbindAddr - the bind addressbindPort - the bind portpublic SSDPPacket receive() throws IOException
IOException - if an I/O error occurspublic boolean send(String msg)
msg - the message to sendpublic boolean send(String msg, String bindAddr, int bindPort)
msg - the message to sendbindAddr - the bind addressbindPort - the bind port