In lab Assignment 3 - Using fork()



TCP vs UDP (part 2)

In the previous lab we worked with UDP sockets.

Let's imagine that we have 2 TCP Echo clients. A simple one like the one you used before and another one that after it connects to the server and before it starts exchanging data with the server it sleeps for a period of time - e.g. 45secs. Run the server and then connect the client that sleeps. Immediately after connect the "simple" client. What you will see is that the second client waits for the first to be served.

In this lab assignment you are asked to implement the TCP server in such a way that the client that has to send data first will not have to wait for other clients that are already connected to the server to be served first.

Tip 1: Just modify the TCP server that you are being given above.

Tip 2:Use fork().