How to solve: sending UDP packet using Sendto() got “message too long”

后端 未结 3 623
执笔经年
执笔经年 2021-01-13 08:30

I want to use the sendto() API to send video and audio data through UDP packet. The sending buffer size I got using getsockopt() is 114688, however, sendto() returned -1 wh

3条回答
  •  猫巷女王i
    2021-01-13 09:09

    You can not send messages (datagrams) larger than 2^16 65536 octets with UDP. The length field of a UDP packet is 16 bits. The buffer sizes you're requesting are not about the size for a packet, but how many octets the OS does buffer incoming and outgoing in total (spread over multiple packets). But a single packet can not get larger.

提交回复
热议问题