How can I distinguish between a broadcasted message and a direct message for my ip?
I'm doing this in python.
Basically what you need to do is create a raw socket, receive a datagram, and examine the destination address in the header. If that address is a broadcast address for the network adapter the socket is bound to, then you're golden.
I don't know how to do this in Python, so I suggest looking for examples of raw sockets and go from there. Bear in mind, you will need root access to use raw sockets, and you had better be real careful if you plan on sending using a raw socket.
As you might imagine, this will not be a fun thing to do. I suggest trying to find a way to avoid doing this.
Distinguishing between broadcasted messages and direct messages