resourcepool / ssdp-client

The most lightweight asynchronous Java SSDP (Simple Service Discovery Protocol) Client
Apache License 2.0
52 stars 21 forks source link

When specifying the SSDP Search port as 1900, some devices do not respond #40

Open RuralTree opened 10 months ago

RuralTree commented 10 months ago
/**
 * 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); } }