A brief history of sockets
Berkeley unix - BSD invented the sockets API. While these days about the only important thing we use sockets programming for is TCP/IP and UDP protocols, the sockets API was designed to support all manner of different networking protocols.
Take a look at the socket man page:
https://man7.org/linux/man-pages/man2/socket.2.html
There are all sorts of wacky protocols most of which are completely obsolete today.
The legacy is reflected in the design of the sockets API - everything is very very flexible which makes the APIs tricky to deal with for a novice C programmer.