4.1 The socket call

First the socket function needs to be called to create a communication end-point construct from the server process’s perspective. You can use man 2 socket to read the exact and official documentation of socket.

This module is only intended to handle named sockets. For this purpose, the domain parameter should be AF_LOCAL. As for the type parameter, SOCK_STREAM is appropriate for any application that only needs to rely on stream-based communication. The type parameter can also be bitwise-ored with SOCK_NONBLOCK to indicate the socket is a non-blocking socket.

The protocol parameter is not useful with stream-based communication. It should be 0.

The function returns a file descriptor (FD). If the function is successful, the return value is non-negative. The returned FD specifies an end-point. However, the end-point is not attached (bound) to anything. As a result, nothing can connect to this end point right now.