Bulb stops to respond to SSDP requests after some minutes

Hi,

I’m playing around with my RGB bulb. I try to implement a Java client that allows me to discover and control bulbs.

The first few SSDP calls are answered by the bulb, but then it stops responding. I’ve used wireshark to record the sent packets:

The initial advertisement is sent (why 3 times?), the subsequent 2 calls are answered and then the bulb remains silent. But the control mode works flawlessly and the device responds to ping requests.

Do you have an idea what’s going wrong? I suppose this isn’t the intended behavior.

I’ve reduced my code to the absolute essential parts and it’s still not working. I’ve also compared it to your Android example app and it’s basically the same code.

public static void main(String[] args) throws Exception {
    String NL = "\r\n";
    StringBuilder sb = new StringBuilder();
    sb.append("M-SEARCH * HTTP/1.1").append(NL);
    sb.append("HOST: 239.255.255.250:1982").append(NL);
    sb.append("MAN: \"ssdp:discover\"").append(NL);
    sb.append("ST: wifi_bulb").append(NL);

    try(DatagramSocket s = new DatagramSocket()) {
        InetAddress address = InetAddress.getByName("239.255.255.250");
        s.setSoTimeout(5000);

        String str = sb.toString();
        DatagramPacket hi = new DatagramPacket(str.getBytes(), str.length(), address, 1982);
        s.send(hi);

        byte[] buf = new byte[2048];
        DatagramPacket recv = new DatagramPacket(buf, buf.length);
        s.receive(recv);
        System.out.println("Received data: " + recv.getLength() + "\n"
                + new String(buf, recv.getOffset(), recv.getLength()));
    }
}

If I switch it off and on, it’s working again. I’ve tested it right now and the device answered 15 calls correctly (the first call is answered once; all other calls get answered twice?), then it stopped answering again.

Firmware version is 1.4.1_48.

Are you using Openwrt router? Some router have IGMP snooping feature which will cause the lost of IGMP messages.
Please refer to this thread.

1 Like