Which port to listen to after UDP Broadcast?

1k Views Asked by At

I am working with Smart Bulbs. They have a LAN protocol that allows to communicate with the devices. The first step is to discover all the devices on the network. Here in the documentation it says that i can broadcast a udp message at port 56700 and i'll get a response from all the devices. But i am not sure what port i am supposed to listen to. I am listening to the same port and i only get the broadcasted message but no reply from the bulbs. I am broadcasting by using the IP address 255.255.255.255 and i am using python.

1

There are 1 best solutions below

0
Barmar On

The replies should go to the source port of the message that you sent.

Call socket.bind() with the port set to 0. The OS will assign a port, and then you should be able to listen on the same socket that you used to send the packets.