4 ms·
Once Again on TCP vs. UDP
- tokenrove 11y agoSadly 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 11y agoSCTP 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 11y agoMost 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 11y agoI wasn't aware WebRTC used SCTP. Good to know!
- nickpsecurity 11y agoI 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 11y agoLooks 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 11y agoDidnt know about that one.
- dedalus 11y agohttps://en.wikipedia.org/wiki/Reliable_User_Datagram_Protocol https://en.wikipedia.org/wiki/Reliable_User_Datagram_Protoco... 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/1d58d53ee530a4b4c7427af8953affe8190c.pdf https://pdfs.semanticscholar.org/1d88/1d58d53ee530a4b4c7427a...
- FullyFunctional 11y agoTCP 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.