
Once Again on TCP vs. UDP - vimes656
http://ithare.com/once-again-on-tcp-vs-udp/
======
dedalus
[https://en.wikipedia.org/wiki/Reliable_User_Datagram_Protoco...](https://en.wikipedia.org/wiki/Reliable_User_Datagram_Protocol)
is also a good protocol in this space.

Its been a decade since I worked with atou (Almost TCP over UDP) but it does
work:
[http://www.csm.ornl.gov/~dunigan/net100/atou.html](http://www.csm.ornl.gov/~dunigan/net100/atou.html)

An excellent read on how to implement reliable UDP by Craig is here:
[https://pdfs.semanticscholar.org/1d88/1d58d53ee530a4b4c7427a...](https://pdfs.semanticscholar.org/1d88/1d58d53ee530a4b4c7427af8953affe8190c.pdf)

------
nickpsecurity
I tell people to start with UDT when trying to improve TCP or UDP:

[http://udt.sourceforge.net/](http://udt.sourceforge.net/)

Good chance they already did what you need. On supercomputers with a
distributed filesystem (Sector/Sphere) at that. :)

~~~
corysama
Looks like UDT is well-suited for high bandwidth networks. I'll vouch for ENet
for reliable UDP over low bandwidth networks.

[http://enet.bespin.org/](http://enet.bespin.org/)

~~~
nickpsecurity
Didnt know about that one.

------
tokenrove
Sadly no mention of SCTP, which, if you don't need to communicate with
arbitrary hosts over the Internet, sits in a nice middleground between TCP and
UDP.

~~~
marios
SCTP tries to be the best of the two, and as such it feels "overengineered".
But besides that, the main problem I see is that you can't communicate with
arbitrary hosts. There is a SCTP implementation in the Linux kernel, besides
the 'reference' one that is developped against FreeBSD. For OS X, you need to
install a kernel extension and for Windows I don't really remember TBH.

Of course, you could use a userspace stack but you still have another problem:
all the middleboxes between you can your destination. Anything that tries to
be smart about your packets (NAT, proxies, younameit) may break your
connectivity simply because it only understands TCP and UDP. I guess you could
use UDP encapsulation but personally I'd start questioning whether picking
SCTP as a transport protocol is worth all this trouble.

~~~
zurn
Most SCTP use (WebRTC) is UDP-encapsulated, needs no kernel support, and works
just fine with NAT. The UDP encapsulation doesn't add any "trouble" compared
to your own ad-hoc UDP-encapsulated protocol, but you still get the advantages
of a properly engineered IETF designed standard protocol.

~~~
marios
I wasn't aware WebRTC used SCTP. Good to know!

------
FullyFunctional
TCP and UDP aren't the perfect solutions [for everything] and there's no
shortage of proposed alternatives to TCP; Besides already mentioned QUIC,
there's CurveCP ([https://curvecp.org/](https://curvecp.org/)), MinimaLT
([https://www.ethos-os.org/](https://www.ethos-os.org/)), or even more extreme
Named Data Networking ([http://named-data.net](http://named-data.net)).

For a background on _why_ TCP is this way, look up "The Design Philosophy of
the DARPA Internet Protocols", by David D. Clark, however knowing is little
comfort.

