REFERENCE: [Stevens, Chapter 6].
This is a user API from BSD Unix (ca. 1982). An alternative is the Transport Layer Interface (TLI) from System V (ca. 1986), and modeled after the OSI model [Stevens, Chapter 7]. To access these libraries, you compile your program as follows:
Here is how the server-client would be implemented using Berkeley sockets. There are two versions, depending on whether the communication is connection-oriented or not:
CONNECTION-BASED SERVER:
CONNECTION-BASED CLIENT:
CONNECTIONLESS SERVER:
CONNECTIONLESS CLIENT:
Note that only the connection-based client skip the bind() step. Below we try to explain this.