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

查看:357
本文介绍了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天全站免登陆