UDP sendto() and recvfrom() max buffer size

前端 未结 3 1799
忘掉有多难
忘掉有多难 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条回答
  •  心在旅途
    2020-12-29 11:29

    No.

    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.

提交回复
热议问题