开发者

python socket.PF_PACKET

开发者 https://www.devze.com 2023-01-18 01:12 出处:网络
I am trying to send out an ARP request with python, working with dpkt, and I found some sample code that uses:

I am trying to send out an ARP request with python, working with dpkt, and I found some sample code that uses:

socket.socket(socket.PF_PACKET, socket.SOCK_RAW)

I understand that you need to use raw sockets to send this, but it says that socket.PF_PACKET do开发者_如何学JAVAesn't exist. And there is nothing in the python docs about it that I have seen. So, where would this person have gotten PF_PACKET from, what would it do, and how can I get it?


Edited my reply:

PF_PACKET was introduced in Linux versions 2.0 and above. Python only wraps the socket interface of the operating system. AaronMcSmooth comment verifies that it is available on Linux. It is not available on mac though.

Also it looks like AF_PACKET may get preferred in 3.2

  • http://bugs.python.org/issue8270
0

精彩评论

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