5min chapter

Go Time: Golang, Software Engineering cover image

TCP & UDP

Go Time: Golang, Software Engineering

CHAPTER

TCP vs UDP - What's the Difference?

With TCP, like you know, your messages are getting there eventually. But with UDP, that's very much not the case. So for instance, we talked about reading data from a TCP connection in Go, you create a byte slice of a certain size and you will keep reading data into that until it's full or there's no more data to read. With UDP, it's different. If I send you four separate UDP packets, and they're sitting in your receive buffer, if you're using net.con, and you read, even if the byte slice you've allocated is large enough to hold all four of those messages, every invocation of read only returns one message at a time

00:00

Get the Snipd
podcast app

Unlock the knowledge in podcasts with the podcast player of the future.
App store bannerPlay store banner

AI-powered
podcast player

Listen to all your favourite podcasts with AI-powered features

Discover
highlights

Listen to the best highlights from the podcasts you love and dive into the full episode

Save any
moment

Hear something you like? Tap your headphones to save it with AI-generated key takeaways

Share
& Export

Send highlights to Twitter, WhatsApp or export them to Notion, Readwise & more

AI-powered
podcast player

Listen to all your favourite podcasts with AI-powered features

Discover
highlights

Listen to the best highlights from the podcasts you love and dive into the full episode