Final answer:
The assignment involves filling in the correct parameters for socket API functions in C to establish a TCP connection on the same machine.
Step-by-step explanation:
The student is tasked with completing the socket API parameters for a TCP socket connection program in the INET domain, using C programming language. For the server code, the correct parameters for the socket() system call would be AF_INET for the domain, SOCK_STREAM for the TCP socket type, and 0 for the protocol which typically defaults to TCP. The bind() function needs the listenfd as the socket file descriptor, a pointer to serv_addr as the address to bind to, and the size of serv_addr. For the listen() function, the parameters are the socket file descriptor listenfd and the backlog size, which is 10. The accept() function in the server code requires the listenfd, a pointer to the client address structure cli_addr, and a pointer to the size of this structure which is cli_size.
On the client side, the socket() call will have the same parameters as the server. However, for the connect() call, the parameters needed are the socket file descriptor sockfd, a pointer to serv_addr, and the size of serv_addr. The use of setsockopt() with the SO_REUSEADDR option is crucial for allowing the server to bind to a port that has been used recently.
Parameters for socket(), bind(), listen(), and accept() calls are required for the server-side, while the client needs parameters for socket() and connect(). The use of setsockopt() with SO_REUSEADDR option enables the server to reuse the port immediately after the program is restarted.