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?
Asked
Active
Viewed 244 times
0
-
This protocol will be built on top of UDP for traversing NAT firewalls – bbosak Jun 13 '11 at 23:03
2 Answers
1
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.

msw
- 42,753
- 9
- 87
- 112
-
Due to firewall restrictions, TCP is simply out of the question. (we're developing a P2P app for mobile devices and desktop computers, and most people don't know how to reconfigure their NATs, so UDP is needed (UDP hole punching), and we're building a reliable layer on top of that). – bbosak Jun 13 '11 at 23:02
-
Then don't re-invent the wheel, steal it: http://en.wikipedia.org/wiki/UDP_hole_punching – msw Jun 13 '11 at 23:36
-
The problem is that it NEEDS to be re-invented, because UDP isn't reliable, and I'm already using UDP hole punching; it's just not "reliable" like TCP – bbosak Jun 13 '11 at 23:40
-
TCP implements a reliable transport over an unreliable datagram service, which is exactly what you are trying to do. It appears as if you are hoping to get out of doing your "homework"; there is no royal road to transmission protocols, but you could do a lot worse than Tanenbaum's "Computer Networks". – msw Jun 14 '11 at 00:28
0
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.

bbosak
- 5,353
- 7
- 42
- 60