开发者

Current udp packets queue length

开发者 https://www.devze.com 2023-01-24 22:17 出处:网络
I have rather simple UDP server written on c. Sometimes i need to know current length of all udp packets(bytes) queued in socket.

I have rather simple UDP server written on c. Sometimes i need to know current length of all udp packets(bytes) queued in socket. As i understand, getsockopt doesn't get such information.

Linux and FreeBSD solutions are both 开发者_如何学运维welcome, thanks!


ioctl(FIONREAD, ...) should be roughly what you are looking for,

http://www.daemon-systems.org/man/ioctl.2.html


From outside of the server (command line), you can do

netstat -uln

which will show you the length of all listening udp sockets.

0

精彩评论

暂无评论...
验证码 换一张
取 消