以编程方式在C中设置MTU [英] set MTU in C programmatically

查看:138
本文介绍了以编程方式在C中设置MTU的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

客户请求的MTU限制应为1492.

A client requested that the MTU limit should be 1492.

在源代码(用C语言编写的程序)中是否可以做到这一点?

Is there a way to do it in the source code (program in C)?

一般还有其他方法吗? (ifconfig?)

Is there any other way to do it in general? (ifconfig?)

为什么有人需要将MTU修改为特定限制?有什么好处?而最 重要:通过更改MTU,是否有破解代码的风险?

Why does somebody needs to modify MTU to a certain limit? What is the benefit? And the most important: By changing the MTU is there any risk to break the code?

推荐答案

这与速度无关.通过增加MTU,您可以减少开销,开销是负责正确交付软件包的数据,但最终用户无法使用.这可以提高速度,但仅适用于交通繁忙;

It's not about speed directly; By increasing MTU you're reducing overhead, which is data that is responsible for the proper delivery of the package but it's not usable by the end user; This can have a increase in speed but only for heavy traffic;

此外,如果增加MTU,则倾向于增加丢弃的数据包的数量(因为您具有固定的误码率和数据包中的更多位),最终导致重发数据包的性能下降,等等...这是开销与数据完整性之间的折衷;

Also, if you increase MTU, you're prone to increase the number of packets that are dropped (since you have a fixed bit error probability and more bits in a packet), eventually causing a decrease in performance with resent packets, etc... So it's a compromise between overhead and data integrity;

我猜想它更多是一种接口配置,而不是您通过程序控制的东西.因此,最好坚持使用"ifconfig"命令或为Windows找到等效的解决方案.

I guess that it is more of a interface configuration than something you control with a program; So it's better to stick with 'ifconfig' command or find the equivalent solution for Windows.

这篇关于以编程方式在C中设置MTU的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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