Sort of what I\'m asking is \"how to make a software firewall for Windows,\" but something not so complex. I\'m surprised I can find so little when searching for this, only the
I think what you are looking for is a packet sniffer, it will intercept almost all communications over a network. If you want to use a library, check out WinPCap, which was meant for exactly this purpose.
Also, if you think that you just want something pre-written and just want to modify it, check out Wireshark. Although, reading code is often more difficult than writing it.