The conversation
send(s, addr_of_data, len_of_data, 0);
recv(s, addr_of_buffer, len_of_buffer, 0);
The send() and recv() function calls specify the sockets on which to communicate, the address in memory of the buffer that contains, or will contain, the data (addr_of_data, addr_of_buffer), the size of this buffer (len_of_data, len_of_buffer), and a flag that tells how the data is to be sent. Using the flag 0 tells TCP/IP to transfer the data normally. The server uses the socket that is returned from the accept() call.
These functions return the amount of data that was either sent or received. Because stream sockets send and receive information in streams of data, it can take more than one call to send() or recv() to transfer all the data. It is up to the client and server to agree on some mechanism of signaling that all the data has been transferred.
close(s);