UDP的sendto()和recvfrom()最大缓冲区大小 [英] UDP sendto() and recvfrom() max buffer size

查看:3482
本文介绍了UDP的sendto()和recvfrom()最大缓冲区大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知,默认最大缓存大小,我可以用这些功能用的是65507(5535 - IPv4报头 - UDP报头)。但是,有没有办法来改变呢?我需要能够发送较大的缓冲区〜66000字节。我试着使用setsockopt()函数,但它似乎没有工作。

I understand that the default max buffer size I can use with these functions is 65507 (5535 - IPv4 header - UDP header). However, is there a way to change this? I need to be able send a larger buffer ~66000 bytes. I tried using the setsockopt() function, but it didn't seem to work.

谢谢!

推荐答案

没有。

UDP只提供了一个数据报作为一个IP包的数据部分,一个IP包具有16位的长度字段因此数据限制为2 ^ 16字节包括标头,或用于UDP数据部分65507字节(假设没有IPv4的选项),有没有办法来处理与UDP数据包较大,除了在几个包拆分起来,并处理重组等自己。

UDP only provides a datagram as the data part of an IP packet, an IP packet has a 16 bit length field thus limiting the data to 2^16 bytes including the headers, or 65507 bytes for the UDP data part(assuming no ipv4 options), there's no way to handle larger packets with UDP besides splitting them up in several packets and handle the reassembly etc. yourself.

这篇关于UDP的sendto()和recvfrom()最大缓冲区大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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