DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Developing applications over TCP/IP using Internet sockets

Making a connection (Internet domain)

Once a process has bound a local socket, the process can rendezvous with an unrelated foreign process (a process initiated by a remote source). Usually, the rendezvous takes the form of a client-server relationship. The client completes the other side of the socket pair when it requests services from the server, initiating a connection by issuing a connect call:

struct sockaddr_in server;
connect(s, (struct sockaddr *) &server, sizeof (server));

server is the Internet address and port number of the server to which the client is connecting. If the client process's socket is unbound when it issues the connect call, the system automatically selects a name and binds the socket. If the socket is successfully associated with the server, data transfer can begin. If not, an error is returned. See ``Connection errors (Internet domain)'' for the list of errors.

Only the active process uses connect. An active process is a process that initiates a connection; a passive process, such as a server process, listens for calls and accepts them, but does not initiate them.


Next topic: The server (Internet domain)
Previous topic: Binding socket names (Internet domain)

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003