Tahlil
Tahlil

Reputation: 2721

Is UDP packet payload size fixed?

How do I find out the current UDP packet payload size for a udp socket? Or is there any way to set it manually? I could not find any socket options related to that.

Upvotes: 0

Views: 2212

Answers (1)

user207421
user207421

Reputation: 310840

How do I find out the current UDP packet payload size for a udp socket?

There isn't such a thing.

Each datagram can have its own payload size, up to the maximum as determined by the outgoing socket's socket send buffer size, up to the absolute maximum dictated by the protocol, which is 65507 for IPv4. In practice the maximum recommended size through routers is 534 bytes.

The size of a received datagram is returned by recvfrom().

Upvotes: 1

Related Questions