/**
* Open MulticastSocket and bind to Ssdp port.
*
* @param options
*/
private void openAndBindSocket(SsdpClientOptions options) {
try {
//There is no need to set a UDP send port here, as some devices do not respond to the SSDP query protocol after 1900. If other ports are set, also check if the ports are available. Here, the system can randomly specify a port
this.clientSocket = new MulticastSocket(options.getBindingPort());
this.clientSocket.setReuseAddress(true);
interfaces = Utils.getMulticastInterfaces();
joinGroupOnAllInterfaces(SsdpParams.getSsdpMulticastAddress(), options.getIgnoreInterfaceDiscoveryErrors());
} catch (IOException e) {
callback.onFailed(e);
}
}
//There is no need to set a UDP send port here, as some devices do not respond to the SSDP query protocol after 1900. If other ports are set, also check if the ports are available. Here, the system can randomly specify a port this.clientSocket = new MulticastSocket(options.getBindingPort()); this.clientSocket.setReuseAddress(true); interfaces = Utils.getMulticastInterfaces(); joinGroupOnAllInterfaces(SsdpParams.getSsdpMulticastAddress(), options.getIgnoreInterfaceDiscoveryErrors()); } catch (IOException e) { callback.onFailed(e); } }