We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

TCP vs. UDP

Click to play video

User Datagram Protocol (UDP) is often compared to TCP, as they are both transport layer protocols. Here are the high-level differences between the two:

TCP UDP
Connection Yes No
Handshake Yes No
In Order Yes No
Blazingly Fast No Yes

TCP establishes a connection between sender and receiver with a handshake, and ensures that all the data is sent in order. UDP yeets the data to the receiver and hopes they can make sense of it.

There are a lot of good TCP/UDP memes...

Assignment

  1. That's because TCP requires a connection to be established before data can be sent! UDP has no such requirement.

  2. go run ./cmd/tcplistener | tee /tmp/tcplistener.txt
    

Run and submit the CLI tests.