2013-06-18 63 views
2

在Linux上,可以創建一個帶AF_PACKET的套接字,以便從套接字接收原始數據並在應用程序中執行IP過濾。但OSX的手冊頁沒有這個:OSX上的AF_PACKET

 PF_LOCAL  Host-internal protocols, formerly called PF_UNIX, 
     PF_UNIX   Host-internal protocols, deprecated, use PF_LOCAL, 
     PF_INET   Internet version 4 protocols, 
     PF_ROUTE  Internal Routing protocol, 
     PF_KEY   Internal key-management function, 
     PF_INET6  Internet version 6 protocols, 
     PF_SYSTEM  System domain, 
     PF_NDRV   Raw access to network device 

這不是POSIX標準接口嗎?如何在OSX上實現相同的功能?

+0

[AF \ _PACKET等效於Mac OS X(Darwin)]中可能的重複](http://stackoverflow.com/questions/7284853/af-packet-equivalent-under-mac-os- x-darwin) – Macmade

+0

@Macmade:謝謝。但哪個更接近POSIX標準? – lang2

回答