Chapter 4. Socket Types and Protocols

In Chapter 1, "Introducing Sockets," you saw how the socketpair(2) function was used to create a pair of local sockets. In this chapter, you will also learn about the socket(2) function to create a socket. These two functions have the domain, the socket type, and the protocol ingredients in common.

This chapter will build on the previous chapters by primarily focusing on the socket(2) function call. This includes expanding upon the following:

  • The domain argument

  • The socket type argument

  • The protocol argument

Specifying the Domain of a Socket

In Chapter 1, you read that for the socketpair(2) function, the domain argument must be the value AF_LOCAL or AF_UNIX (remember, these were equivalent). Then in Chapter 2, you ...

Get Linux Socket Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.