Skip to content
0:00 / 0:00

#tcp#tun-tap#rfc793

Implementing TCP in Rust (part 1)

Jon Gjengset

111K subscribers • 9 videos on Hallway

YouTube
  • Recommended by 2 people: 2 in engineering communities.
  • Presented by Jon Gjengset
  • Linked in the descriptionjonhoo/rust-tcp

Advanced. Deep dive for people who know the field.

263K views7 years ago2 recommendations

Programming languagesSystems programmingRustNetworking and protocolsConcurrency and parallelism

Jon Gjengset live-codes a user-space TCP stack in Rust from scratch following RFC 793.

In this stream, we started implementing the ubiquitous TCP protocol that underlies much of the traffic on the internet! In particular, we followed RFC 793 — tools.ietf.org/html/rfc793 — which describes the original protocol, with the goal of being able to set up and tear down a connection with a "real" TCP stack at the other end (netcat in particular). We're writing it using a user-space networking interface (see kernel.org/doc/Documentation/networking/tuntap.txt and the Rust bindings at docs.rs/tun-tap/). We got decently far, and are now able to both establish an incoming TCP connection (i.e., perform the TCP three-way handshake) and terminate the connection cleanly. You can find the current code at github.com/jonhoo/rust-tcp. There's still a long way to go though, as we still need to add support for data segments, retransmissions, and timers; so that's what we'll cover in the next stream! Eventually, we will also want to implement RFC 1122 — tools.ietf.org/html/rfc1122 — which lays out a number of further enhancements that must be made in order to interoperate nicely on the internet. This is also discussed in RFC 7414: tools.ietf.org/html/rfc7414#section-2, which we're also aiming to support. You can see the live version with comments at youtu.be/_OnJ9z-e_TY

Why it's here

2 people recommend this

What people say. Recommended as an excellent, deep-dive live-coding session on network protocols and systems programming in Rust.

u/GreedyDatein r/embedded • Recommends

On “Python perspectives in embedded”

…help, because most of the industry writes these in C (some do go for C++, but very few). Do you wish to write applications for those bare metal stuff you just made? Here going for a higher level language will be helpful, because many things are already taken care by someone else. Also check out rust. Here's a video where a guy writes TCP in rust link to this video…

u/newbgopherin r/programming • Recommends

On “Part 2 - How to Make Notepad on Windows 2000 (C & Win32 API Tutorial)”

anything OS or protocol related like this one link to this video