TCP & UDP
The internet wouldnât exist as we know it if it werenât for TCP and UDP, yet many developers donât quite understand the technology powering the web. In this episode we talk with Adam Woodbeck, author of Network Programming with Go, to learn about TCP and UDP; what they are, how they work, and how one can experiment with tools like Wireshark and Go to learn more.
Matched from the episode's transcript đ
Kris Brandow: I think one of the interesting things about these network protocols is why did we develop TCP the way we did⌠I think a lot of that had to do with network congestion, and people just overloading networks. And when networks overload [unintelligible 00:49:41.28] thatâs why we have window sizes, and all of these other thingsâŚ
I think itâs interesting that weâve gotten to a point now where those things have become more of a hindrance to us in some circumstances than they are a benefit. I think a really good example of that is the journey that HTTP has been on. We all started with HTTP/1, HTTP/1.1, where it was a text protocol and you couldnât multiplex; and we had this head of line blocking problem, so you had to open multiple TCP connections to make to make browsers faster⌠And then we made HTTP/2, which added multiplexing, but it was still over a TCP connection, and we immediately ran into more head of line blocking problems, because TCP is ordered. So even if you have independent streams of things happening, if one gets blocked with processing or whatever, then all the strings get blocked, and this protocol that was supposed to be magically faster actually turned out to be really bad if you had a really crappy networkâŚ
And I think the other thing that we also started figuring out is that TCP works really great if youâre not moving, if you are a desktop, or youâre on Wi-Fi and you can establish those connections. But as soon as youâre hopping between Wi-Fi and a mobile network, now you have problems⌠Because with a mobile network they kind of make it appear as if you still have a TCP connection. But if you switch to Wi-Fi, your TCP connections are now gone and you have to reestablish them, which is super-expensive⌠So QUIC/HTTP/3 is now giving us the ability to move those connections between things, where you can go between a mobile network and Wi-Fi, and keep your connections alive. But itâs essentially just rebuilding everything we had in TCP on top of UDP, because TCP is too restrictive.