bbosak
bbosak

Reputation: 5529

How many times should I retransmit a packet before assuming that it was lost?

I've been creating a reliable networking protocol similar to TCP, and was wondering what a good default value for a re-transmit threshold should be on a packet (the number of times I resend the packet before assuming that the connection was broken). How can I find the optimal number of retries on a network? Also; not all networks have the same reliability, so I'd imagine this 'optimal' value would vary between networks. Is there a good way to calculate the optimal number of retries? Also; how many milliseconds should I wait before re-trying?

Upvotes: 0

Views: 320

Answers (2)

bbosak
bbosak

Reputation: 5529

I ended up allowing the application to set this value, with a default value of 5 retries. This seemed to work across a large number of networks in our testing scenarios.

Upvotes: 0

msw
msw

Reputation: 43527

This question cannot be answered as presented as there are far, far too many real world complexities that must be factored in.

If you want TCP, use TCP. If you want to design a custom-protocol for transport layer, you will do worse than 40 years of cumulative experience coded into TCP will do.

If you don't look at the existing literature, you will miss a good hundred design considerations that will never occur to you sitting at your desk.

Upvotes: 1

Related Questions