Go to main content

Oracle® Solaris 11.3 Programming Interfaces Guide

Exit Print View

Updated: April 2019

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() call initiates a connection. In the UNIX family, this might appear as:

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

For more information about connection errors, see Connection Errors. Data Transfer tells you how to transfer data. Closing Sockets tells you how to close a socket.