in reply to Using socket instead of pcap

Sockets are interfaces between applications (Layer 5 and above) and the transport (Layer 4) - See the OSI Model reference at Wikipedea.

pcap and friends capture and analyze packets at layer 2 and above.

I'm hoping that is enough said - case closed.

     Syntactic sugar causes cancer of the semicolon.        --Alan Perlis