Question: Solve the following two problems for for client-server for both TCP and UDP server. Should be done in C. Help will be appreciated (10 points)

Solve the following two problems for for client-server for both TCP and UDP server.

Should be done in C.

Help will be appreciated

Solve the following two problems for for client-server for both TCP and

(10 points) Write a TCP server and a TCP client program, where the TCP client asks for a specific file (provide unique filename) from the TCP server. The TCP server reads an existing text file and sends it to the TCP client. The TCP server is expected to read each line of the file at a time and send it over socket. If there are n lines in the file, there should be n transmissions. After the server detects end-of-file, it should transmit a special character (examples are S, # etc.), known to the client, indicating the end of file. At the client, open a file, and as each line is received from the socket, write that in the file. When the special character is received, close the file and the socket. The filename and port number should be arguments in the program, both at the client and the server codes. (10 points) Write a UDP server and a UDP client program, where the UDP client gets a text message from the user, attaches a header ("UDP Client 1") to the message and sends to the UDP server. On receiving this sage, the UDP server parses the message, strips the header, displays the message in terminal, converts the message to uppercase, attaches another header ("UDP Server") to the message and finally sends it to the client. On receiving this packet, UDP client should strip the header and display the message it received from the server. You may assume that both the server and the client knows the length of the respective header fields. (10 points) Write a TCP server and a TCP client program, where the TCP client asks for a specific file (provide unique filename) from the TCP server. The TCP server reads an existing text file and sends it to the TCP client. The TCP server is expected to read each line of the file at a time and send it over socket. If there are n lines in the file, there should be n transmissions. After the server detects end-of-file, it should transmit a special character (examples are S, # etc.), known to the client, indicating the end of file. At the client, open a file, and as each line is received from the socket, write that in the file. When the special character is received, close the file and the socket. The filename and port number should be arguments in the program, both at the client and the server codes. (10 points) Write a UDP server and a UDP client program, where the UDP client gets a text message from the user, attaches a header ("UDP Client 1") to the message and sends to the UDP server. On receiving this sage, the UDP server parses the message, strips the header, displays the message in terminal, converts the message to uppercase, attaches another header ("UDP Server") to the message and finally sends it to the client. On receiving this packet, UDP client should strip the header and display the message it received from the server. You may assume that both the server and the client knows the length of the respective header fields

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!