Network fetching

Hi, I was wondering if and how it is possible to fetch network data like Nighthawk does, I don't need anything special really, what flies through the sockets.

Only possible way I could think of was to set the DNS server to localhost and to listen on those ports, but that would work if I knew the ports.
Have you looked into packet sniffers?
no I did not, what are they? I was working with sockets, but that was about it, but don't know how to sniff packets.
from what I get here the packet sniffers gather information from the entire network, while I'd like to know how to do this on a pc that the program is running, also I seem to have given the wrong example for what I'd like to do.

tofiffe wrote:
from what I get here the packet sniffers gather information from the entire network
Yes, you have a highway full of cars driving by.
tofiffe wrote:
I'd like to know how to do this on a pc that the program is running
You're only interested in cars that come from one direction.

What's the problem? Just ignore the other packets that aren't from that computer.
is that really the best way to do it? I've even thought of only gathering events going outside.

Also I've tried googling stuff like that but could not find a proper pseudocode/actual code, mind giving me a little hint?
I have never done anything related to packet sniffing, I'm just telling you what I know.

Just a quick search and I found dozens of relevant open-source projects (C/C++):
https://github.com/search?q=packet+analyzer&ref=cmdform
Topic archived. No new replies allowed.