Hi guys,
I'm using a Linux system(Ubuntu) and I've been trying to find a method to read the total packets received/sent on a specific port (e.g port 80 or port 25) on a local machine. I can read the overall total packets received/sent from the /proc/net/dev file system. But what I can't do is read packets received/sent from a
specific port. I don't think there is any information about total packets on a specific port in any of the /proc file system. So, what is the best way to get this information?
I would like a way to do this so that I can display the activity on a specific port for my program I'm working on. Thanks
---------- Post updated at 02:46 AM ---------- Previous update was at 02:34 AM ----------
Okay, i've found out that I can use
tcpdump to do this. This can be one of the many ways. I would prefer a different method where I do not need to install packet capture libraries like libpcap for my program to work. Besides, I need to have root privilege to use libpcap. Any other ideas?