Programming Interfaces Guide

Establishing a Connection

Connection establishment is usually asymmetric. One process acts as the client and the other as the server. The server binds a socket to a well-known address associated with the service and blocks on its socket for a connect request. An unrelated process can then connect to the server. The client requests services from the server by initiating a connection to the server's socket. On the client side, the connect(3SOCKET) call initiates a connection. In the UNIX family, this might appear as:

struct sockaddr_un server; = AF_UNIX;
		connect(s, (struct sockaddr *)&server, strlen(server.sun_path) 
         + sizeof (server.sun_family));

See Connection Errors for information on connection errors. Data Transfer tells you how to transfer data. Closing Sockets tells you how to close a socket.