Alberth said:
literally every IP transport protocol including TCP/IP is built on top of UDP
Nope. They're independent.
TCP and UDP usually use IP but theoretically can run on any network model. TCP and UDP are both independent of each other, and quite dramatically so.
People have spent the time to implement many of TCP's features using UDP, implementing their own sliding windows, error checking and recovery, sequencing and reliability features, and all the rest. If they implement the full TCP protocol the overhead would be far greater than just using TCP to begin with, so people don't do that.
UDP and TCP also aren't the only transport protocols. There are several other transport-layer protocols, QUIC (RFC 9000) is a notable one, which is picked up by SteamWorks in games, although developed for modern web browsers. Initially layered with UDP before becoming a draft specification in the earliest days, once it made it to the standards track it only looks like UDP just enough for old networking equipment to let it flow through networks.
hplus0603 said:
It would be interesting to see benchmarks comparing to popular wrapper libraries like Enet and Raknet.
Strongly agreed with this. How does it compare? How does it beat them? I'd also add Steamworks to both of them, which does an amazing job too.
Also it's worth noting that of the 9 online games I've worked on in the past 6 years (whew!) only one has used sockets directly, and that was a port of a homebrew game that happened to win the game development lottery and get a publishing deal. There is little point in re-inventing the wheel for basic connectivity when it's been a solved problem through middleware and first-party libraries for two decades.
There are a ton of features most libraries support these days, or have community support. Encryption through both TLS/DTLS, out-of-band channel communication, connection migration, protection from assorted attacks like DOS attacks, ACK attacks, forgeries and session splitting with ARP attacks, fragmentation attacks, and much more. The high quality of the libraries makes the barrier to enter quite high.