Hacker News new | ask | show | jobs
by cjsplat 1209 days ago
Sure, but what is UDP bringing to the party then? The pseudoheader?

A reasonable RPC layer could just layer on IP.

5 comments

Well, for one, UDP brings the U. It's called the User Datagram Protocol because (at least on UNIX-like systems) unprivileged programs can almost always send and receive UDP datagrams, but in general cannot send and receive raw IP datagrams.
UDP gives you port numbers supported by every networking equiment your datacenter already has, instead of having to deal with raw IP frames or somehow extending how your firewalls and servers handle your special boy packets. Especially useful considering you probably want port numbers anyway, and checksums are just a nice bonus. You'll probably reimplement part of TCP on top of it too.
> Sure, but what is UDP bringing to the party then?

Interoperability. It's been how many years since SCTP was published? How's that going?

You're likely interacting with SCTP every time you use a mobile phone, as it's in heavy use in the control plane of telecom networks. Outside that, not so much though.
Also every Zoom/Google Meet call. WebRTC is on top of SCTP.
WebRTC uses SCTP in a weird way: on top of DTLS, which is itself on top of UDP. When most people talk about using SCTP, they mean using it instead of UDP.
Sort of. SCTP is used for data channels, the audio/video is RTP. Still an important piece though.
Yes but if my program on my laptop wants to talk to my program in my server somewhere out there, chances are the SCTP will be blocked by some piece of blinking furniture along the path.
> Outside that, not so much though.

Thanks for making my point.

The UDP header will give you proper ECMP hashing.
Yup - this is the correct answer
IIRC, UDP just adds port numbers and a checksum to IP. It's about as bare bones as it can get, unless you want to get rid of the checksum too.
Some implementations do skip checksum (leaving it as zero), for instance you can configure a Linux UDP socket to skip it if you can't afford the time it would take to calculate them.