Linux 套接字缓冲区如何溢出? [英] How does a Linux socket buffer overflow?

查看:31
本文介绍了Linux 套接字缓冲区如何溢出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Java 阅读器应用程序,它从 Linux 64 位平台 (2.6.18) 上的多播套接字读取.套接字大小已设置为 2 MB.当读取器读取速度不够快时,套接字溢出",即数据包从缓冲区中丢弃.

I have a Java reader application that reads from a multicast socket on a Linux 64-bit platform (2.6.18). The socket size has been set to 2 MB. When the reader cannot read fast enough the socket "overflows", i.e. packets are dropped from the buffer.

我想知道的是 Linux 内核如何从套接字缓冲区中丢弃数据包.我假设套接字缓冲区本身是一个 FIFO 缓冲区.但是,如果它已满会发生什么?下一个数据包是否会被丢弃(并且缓冲区内容不会改变)?还是新数据包会替换缓冲区中的旧数据包?如果是,哪个数据包(最老的?,最年轻的?,随机选择的数据包?)?

What I would like to know is how the Linux kernel drops packets out of the socket buffer. I assume that the socket buffer itself is a FIFO buffer. However, if it is full what happens? Will the next packet be discarded (and the buffer content does not change)? Or will the new packet replace an old packet in the buffer? If yes, which packet (the oldest?, the youngest?, a randomly chosen packet?)?

感谢您的任何见解.

推荐答案

当缓冲区已满时,传入的数据包将被丢弃.已在缓冲区中的数据包不会被修改或替换.

When the buffer is full, incoming packets are discarded. Packets that are already in the buffer are not modified or replaced.

这篇关于Linux 套接字缓冲区如何溢出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆