Allocating a socket in a client program

From their own perspective, clients must first issue the socket() call to allocate a socket from which to communicate as follows:
s = socket(AF_INET, SOCK_STREAM, 0);

For more information, see Allocating sockets in an iterative server program.