简体   繁体   English

如何发送大于系统缓冲区的UDP数据报?

[英]how to send UDP datagram larger than system buffer?

can any body here tell me how to send datagram larger than system buffer supplied to UDP socket in order to test the MSG_TRANC in C 这里有谁能告诉我如何发送大于提供给UDP套接字的系统缓冲区的数据报,以便在C语言中测试MSG_TRANC

and how i can get the size of the socket buffer ? 以及如何获取套接字缓冲区的大小?

You could always increase the buffer size with the setsockopt function using the SO_SNDBUF flag. 您总是可以使用SO_SNDBUF标志使用setsockopt函数来增加缓冲区大小。

Otherwise send (or sendto ) will normally block. 否则, send (或sendto )通常会阻塞。

However, I would recommend you to try and rework your protocol so the packets fit inside the send buffer. 但是,我建议您尝试对协议进行重新处理,使数据包适合发送缓冲区。 You can always reassemble the packages when received (if you have proper sequencing of them). 您始终可以在收到时重新组装包装(如果对它们进行了适当的排序)。

What do you mean or want to to do? 你是什​​么意思或想做什么?
I hope you read http://en.wikipedia.org/wiki/User_Datagram_Protocol 希望您阅读http://en.wikipedia.org/wiki/User_Datagram_Protocol

Are you attempting to send a datagram with total length greater than single packet size? 您是否要发送总长度大于单个数据包大小的数据报? Or is your send buffer used in building a packet too small? 还是用于构建数据包的发送缓冲区太小?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM