I was going to recommend the pcap library, which I used to write a packet sniffer* (I think this is what the OP is trying to do).

When I googled "pcap windows", I found this:

WinPcap, The...