Hi all!
After surfing the web I ended up here as I could not find a good answer!
I am writing an application with c++ and gtkmm.
I want to access the network card and listen on all ports for packages.
As far as I have found out it is good to use glibc and sys/socket.h to
be able to to send and resieve over the network, but if you use a socket
you assign to a specific port, but I want to listen on all ports for incoming packages
on my host. I far as I understand you can put the network card in some type of
listen mood but where do I find the info on how?
And what header file, function to use?
Please point me in the right direction!

Many thanks in advance!!

Hi,

You need to setup your ethernet card in promiscuous mode, in linux you can use the commands to see every packet.

ifconfig eth0 promisc - Put nic into promiscuous mode to sniff traffic.
tcpdump -n host not XXX.XXX.XXX.XXX | more - Sniff net but ignore IP which is your remote session.
ifconfig eth0 -promisc - Pull nic out of promiscuous mode.

tcpdump uses libpcap to listen every packet. Download the library and tcpdump codes.


Opensource is the best thing ever happened to programmers.

Thank you alwaysLearning0!!
I have started looking into pcap and compiled my first program!

I am with you all the way:
Opensource is the best!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.