ereOn
ereOn

Reputation: 55816

Discovering maximum packet size

I'm working on a network-related project and I am using DTLS (TLS/UDP) to secure communications.

Reading the specifications for DTLS, I've noted that DTLS requires the DF flag (Don't Fragment) to be set.

On my local network if I try to send a message bigger than 1500 bytes, nothing is sent. That makes perfect sense. On Windows the sendto() reports a success but nothing is sent.

I obviously cannot unset the DF flag manually since it is mandatory for DTLS and i'm not sure whether the 1500 bytes limit (MTU ?) could change in some situations. I guess it can.

So, my question is : "Is there a way to discover this limit ?" using APIs ?

If not, what would be the lowest possible value ?

My software runs under UNIX (Linux/MAC OSX) and Windows OSes so different solutions for each OS are welcome ;)

Many thanks.

Upvotes: 0

Views: 795

Answers (2)

caf
caf

Reputation: 239341

There is a minimum MTU that must be supported - 576 bytes, including IP headers. So if you keep your packets below that, you don't have to worry about PMTU-D (that's what DNS does).

Upvotes: 3

SteelBytes
SteelBytes

Reputation: 6965

you probably need to 'auto tune' it by sending a range of packet sizes to the target, and see which arrive. think binary_search ...

Upvotes: 0

Related Questions