Search code examples
c++windowssocketspacket

Receiving an entire UDP packet


I am programming a UDP proxy application for Windows in C++ that sends and receives UDP packets with Winsock. The problem is that I need to work with the ENTIRE packet, not just the data and UDP and/or IP header. I have tried raw sockets with IP_HDRINCL (might be misspelled), but it still chops off some information from the packet. Is there some sort of library or something, if not possible in winsock, that will let me accomplish this?


Solution

  • For receiving packets, WinPCAP will let you do all of this and more, and there's sample code here which shows how to capture all of the packets arriving on an interface.