Connecting sockets is usually not symmetric. One process usually acts as a server and the other process is the client. The server binds its socket to a previously agreed path or address. It then blocks on the socket. For a SOCK_STREAM socket, the server calls listen(3N), which specifies how many connection requests can be queued.
A client initiates a connection to the server's socket by a call to connect(3N). A UNIX domain call appears:
struct sockaddr_un server; ... connect (sd, (struct sockaddr_un *)&server, length);
while an Internet domain call is:
struct sockaddr_in; ... connect (sd, (struct sockaddr_in *)&server, length);
If the client's socket is unbound at the time of the connect call, the system automatically selects and binds a name to the socket.
For a SOCK_STREAM socket, the server calls accept(3N) to complete the connection. accept(3N) returns a new socket descriptor which is valid only for the particular connection. A server can have multiple SOCK_STREAM connections active at one time.