开发者

Distinguishing between broadcasted messages and direct messages

开发者 https://www.devze.com 2022-12-30 00:57 出处:网络
How ca开发者_运维知识库n I distinguish between a broadcasted message and a direct message for my ip?

How ca开发者_运维知识库n 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号