Simple Network Programming
In networking, the terms “client” and “server” describe the party that is waiting for a new connection (the server) and the party that initiates a new connection (the client). Once the communications channel is set up, the client and server are peers that communicate with each other.
Here is the set of calls and actions used when writing a server program:
Get a socket().
Construct an address–port pair that the server will listen on.
bind() the socket to the address.
Tell the socket to start listen()ing for new connections.
accept() new connections from clients.
Use read() and write() to receive and send data over the client connection.
close() the client connection’s socket.
int socket (int domain, ...