简体   繁体   中英

counting total number of tcp sockets with non-empty SNDBUF on a linux machine

is there a way for a C program on a linux server to count total number of tcp sockets with non-empty SNDBUF, that is non-empty pipe, or in other words, when data transfer is in progress. Obviously this would have to be counted at an "instance"... Good approximation of such number would be fine. Thanks.

The /proc/net/tcp file contains a list of all open TCP sockets, and shows the send and receive queues. Finding official documentation on the format of this file is somewhat tricky , but luckily it's somewhat self-explanatory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM