Q:

How do you know which interface a broadcast message came from?

I have a rather odd situation where I will have multiple interfaces connected to the same network. When I receive a broadcast or multicast message, I would like to know what interface it came from. It there a way to do that in C or ideally Python?
Thanks!

A:

The most obvious one would be to bind several sockets, each to one interface only - do not listen to 0.0.0.0. 

