UDP sendto() and recvfrom() max buffer size

前端 未结 3 1793
忘掉有多难
忘掉有多难 2020-12-29 10:33

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

3条回答
  •  旧时难觅i
    2020-12-29 11:25

    The UDP specification gives you 16bits in the UDP header for the packet size, that means you cannot send more than 65k at once. You cannot change this.

    You have to split up your data into multiple packets. Using TCP instead of UDP will make the thing much simpler, since completeness and receiving order are guaranteed.

提交回复
热议问题