Hi All,

I'm trying to connect to a smart bulb on my home WIFI using mcast_send
in IO::Socket::Multicast.

It works on my main Linux Mint laptop. The same script does not work on my
Raspberry PI.

Despite the script running as expected on one laptop I've checked that this
is all set up correctly:

sub new {
    #my $class = shift;
    my $data  = {
        address => '239.255.255.250',
        port    => 1982,
        timeout => 3,
        devices => [],
    };
    return bless( $data );
}

my $socket = IO::Socket::Multicast->new(
        PeerAddr  => $self->{address},
        PeerPort  => $self->{port},
        Proto     => "udp",
        ReuseAddr => 1,
    ) or croak $!;

But it's this part that fails on the PI:

$socket->mcast_send( $query, "$self->{address}:$self->{port}" ) or croak $!;

I've checked that $socket, $query and $self->{address}:$self->{port}
contain the info I expect and they do.

On my Linux laptop I can use tcpdump and see the communication between
laptop and bulb. Doing this on the Pi shows no communication. I've replaced
the "croak" with "die "zzzzzzzzzzzz" so I can be certain it's failing at
that point. I get the output "zzzzzzzzzzzz" (makes it easier to spot).

I've just used a command recently that allows me to access the specific ip
and port of the lamp and it indicates the connection is successful. I'm out
of ideas and if anyone can advise I'd appreciate it.

Slightly (very) out of my depth when it comes to ports and IPs etc.

Thanks,
James

Reply via email to