News for hackers. Stuff that matters.
Re:A full TCP/IP stack in under 200 LoC (and the power of DSLs) by tptacek on Sunday September 27, 2009 @12:16AM (#846521)
Yes, TCP/IP is damned simple if you model it as a trivial lock-step protocol. And this is a slick little piece of code. But it has nothing whatsoever to do with the 10,000+ lines of code that modern operating systems deploy to allow hundreds of competing TCPs to figure out how to share a link.

Interview question: what's the important thing TCP provides over UDP?

Fail answer: I don't know.

Push answer: Reliability.

Win answer: Congestion control.

Re:A full TCP/IP stack in under 200 LoC (and the power of DSLs) by dschobel on Sunday September 27, 2009 @01:33AM (#846560)
Can you explain why there would be hundreds of competing TCPs?

I thought there were only a handful (Tahoe, Reno, Vegas, New Reno et al) of popular algorithms for the congestion control bit but it's all still TCP as specced in RFC 2581, no?

From where does all the complexity come?

Re:A full TCP/IP stack in under 200 LoC (and the power of DSLs) by tptacek on Sunday September 27, 2009 @11:08PM (#847664)
Two laptops attach to a wi-fi hub connected to a DSL line provided by a major telco. One starts a large download. Why doesn't it completely monopolize the skinny straw that connects the 10+mb/s network it actually sees to the gigabit network beyond the DSL? Why can the second laptop start another large download and both see reasonable download speeds? At a more basic level, how do these TCP's even know how fast to drive the transfer? All they see is a multimegabit wireless network. They're not psychic, and there's no configuration box or DHCP setting for "256 kb/s dsl uplink".

That's what TCP actually buys you.

You can make a reliable UDP protocol with a few tens of lines of code. It's called "TFTP", and it's god-awful slow.

Re:A full TCP/IP stack in under 200 LoC (and the power of DSLs) by wmf on Sunday September 27, 2009 @02:31AM (#846599)
He probably means hundreds of competing TCP connections across a single link, which is common in the Internet (or in your LAN if you use BitTorrent).
Re:A full TCP/IP stack in under 200 LoC (and the power of DSLs) by scott_s on Sunday September 27, 2009 @01:37PM (#847040)
This is an important distinction - the difference between production code that takes care of all of the edge cases that make things work in practice and the straight-forward implementation of the basic idea. But I think that's besides the point. The production implementations of TCP could probably be simpler and easier to understand if they were implemented in a similar manner as what's in this article.