UDP vs TCP

I can always spot a programmer talking about networking from a mile away.

The title is "Networking for Game Programmers" and we are on /r/programming, so I'm not sure what you expected.

The network is never reliable. Assuming the network is reliable will lead to serious bugs. Always assume the network is in some state of broken, and your software will be far more reliable.

That's why TCP exists. To address that problem.

A TCP connection is not reliable.

Calling TCP "reliable" is correct. It appears in the first sentence of RFC793. Here's more evidence.

TCP, from a user perspective, either reliably delivers bits in order, or reliably reports errors when unable to deliver packets. No reasonable person would assume or assert that "reliable" in this context refers to the actual wires. Why are you?

TCP is only a stream.

A TCP stream doesn't work without a connection. It's not only a stream.

but the OS kernel makes the connection between the two endpoints

Making this distinction has no benefit.

It's as though the author doesn't know that ICMP exists and that the OS can and will return errors for IP packets. This is where errors like "destination unreachable" come from, which is critical for a programmer to know so they can properly detect and handle errors.

RFC1122 indicates that TCP must report ICMP type 3 by either reporting the condition or terminating the connection. There's no need to handle ICMP manually in application code if you're already using TCP. I'm not even sure it's possible to.

Etc.

/r/programming Thread Parent Link - gafferongames.com