博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
How to monitor Linux UDP buffer available space?
阅读量:7117 次
发布时间:2019-06-28

本文共 1364 字,大约阅读时间需要 4 分钟。

  hot3.png

How to monitor Linux UDP buffer available space?

You are trying to solve the wrong problem. UDP is unreliable communication, period. If packet loss is a problem for you, you should either implement your own retransmission/error control algorithm or not using UDP in the first place. Drop it entirely in favor of TCP, or perhaps something more advanced like SCTP or even DCCP.

UDP is datagram-based, socket buffers should be bigger than the maximum length of an UDP datagram that your application may receive, up to 64kiB. If your application may transmit datagrams larger than this, then it is another reason you should not be using UDP. And it really doesn't matter how big is the buffer, you still may lose packets if your application can't read the socket faster than packets arrive.

You say that you want to know how full the UDP buffer is. This is the sort of thing that doesn't really matter. Just read everything that is waiting on the buffer and you can be sure that when it blocks the buffer will be empty.

If you still want to know how full the buffer is, read the file /proc/net/udp, 

             1. column rx_queue. But if you see any value different than zero in that column, it just means that your application is not reading the socket fast enough.

             2. column tx_queue is the same to rx_queue

   /proc/net/tcp  is  tcp info

转载于:https://my.oschina.net/miffa/blog/357282

你可能感兴趣的文章
IOS 多线程 NSThread
查看>>
Python入门
查看>>
iis部署网站
查看>>
Turn the corner
查看>>
Flipper
查看>>
Jmeter元件的作用域与执行顺序
查看>>
SQL Server 分组操作解析
查看>>
Spring集成RabbitMQ-使用RabbitMQ更方便
查看>>
找硬币
查看>>
bzoj3190[JLOI2013]赛车
查看>>
bzoj4716假摔
查看>>
object-c中数组的排序
查看>>
Es6学习笔记
查看>>
数据库笔记整理——数据库连接(思维导图式)
查看>>
WinForm中如何实现在容器控件中嵌入form窗体(panel与子窗体)
查看>>
正则表达式(百度上找的)
查看>>
php课程---初学练习
查看>>
#题目:GCD XOR UVA - 12716
查看>>
制作PC端的安装程序
查看>>
1.12.4版本发布
查看>>