Does libpcap use raw sockets underneath them?

前端 未结 2 563
野的像风
野的像风 2021-02-08 00:46

I was getting a bit confused on using of raw sockets and libcap. Can, anyone in simple point out advantages of using both. I read few links, but, its making me confused.

2条回答
  •  执笔经年
    2021-02-08 01:09

    "libpcap" and "raw sockets" are different topics.

    Libpcap is a packet capture library for linux which is used to capture the traffic/packets that pass through a network interface like eth0.

    On windows the Winpcap library does the same thing.

    Raw sockets are a feature of the socket api provided by the OS that can be used to send packets with headers defined by the application and not the OS. So using raw sockets we can specify the IP , TCP headers and send the packets.

    Raw sockets are available on Linux since all time. On Windows raw sockets were available only in Windows XP and Windows XP(SP1).

    On windows the winpcap library has a feature to send packets with arbitrary content , which means raw socket functionality can be achieved with winpcap on Windows.

提交回复
热议问题