Any Internet server, from the simplest to the most complicated, first uses the two functions socket and bind to establish an identifiable communications endpoint. The server uses socket to create a socket with the desired type and protocol. The An Internet server must bind a network address to the socket with the bind function. A client can bind an address, but it is not usually necessary in connection-oriented clients. This process specifies the network address to which a client must connect to start communicating with the server.
NAME is the address that is bound to the socket.
Otherwise, any positive 16-bit integer will suffice as long as it is not one of the reserved numbers. For connection-oriented servers like our example program we now can use the listen function to tell the operating system that we'll accept connections on the socket. This lets the server handle several near-simultaneous connection requests, a crucial feature for HTTP servers or daemons like inetd. Now a client program could attempt to connect to the server, but we need more code to actually create the link. For many servers, the accept function is called, typically in a loop of some sort, directly after listen .