Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am writing a simple program in C that compares the performances of various sockets bound to different interfaces and then decide what is the best interface to use in a certain moment, for a certain destination address. This application (let's call it A) will execute while another application (B) is using these sockets (e.g. for streaming).
I thought that the throughput might be the best indicator of performance, but I can't find a method to get the throughput of a socket (which is receiving data, and not sending) in C.
Also, this application can directly take information from the kernel using a /proc file, so I can use all informations inside struct sock and struct tcp_sock.
The important thing is that I cannot send packets in order to calculate this, but only use the already ongoing traffic.
I am a little unclear on your goal but if you wish to monitor all of the sockets the netstat utility is useful for viewing your open socket connections.
netstat -a to see all connections
You will notice a very large amount of data concerning the sockets activity and a little read using man netstat would be most effective. So you don't actually have to write any code to see this as it has already been done for you.
thanks for the reply, but netstat doesn't provide informations on the throughput of the sockets.
I read the man and it seems that there is nothing like bit/s for every tcp socket.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.