Question: IN C LANGUAGE PLEASE Part 1: is a basic echo server-client where the server takes in a port number and the client takes in a

IN C LANGUAGE PLEASE

Part 1: is a basic echo server-client where the server takes in a port number and the client takes in a port number and ip address.

Overview: In this part, you will extend the echo application implemented in Part I to measure the round trip time (RTT) and throughput of the path connecting the client to the server. To measure RTT, you will use TCP to send and receive messages of size 1, 100, 200, 400, 800 and 1000 bytes. To measure throughput, you will use TCP to send and receive messages of size 1K, 2K, 4K, 8K, 16K and 32K bytes. Note the difference in units for the two sets of message sizes. For each measurement and for each message size, the client will send at least ten probe messages to the server, which will echo back the messages.

Protocol phases: As in Part I, the client first needs to set up a TCP connection to the server using the socket interface. The echo application will be extended, however, by specifying the exact protocol interactions between the client and the server. This entails specifying the exact message formats, as well as the different communication phases, as outlined next.

1. Connection Setup Phase (CSP). This is the first phase in the protocol where the client informs the server that it wants to conduct active network measurements in order to compute the RTT and throughput of its path to the server. We will outline the expected behavior from both the client and the server next.

CSP: Client. After setting up a TCP connection to the server, the client must send a single message to the server having the following format:

PROTOCOL PHASE: The protocol phase during the initial setup will be denoted by the lower case character s. This allows the server to differentiate between the different protocol phases that the client can be operating at, as we will see.

M-TYPE (MEASUREMENT TYPE): Allows the client to specify whether it wants to compute the RTT, denoted by rtt, or the throughput, denoted by tput.

PROBES: Allows the client to specify the number of measurement probes that the server should expect to receive. Once all the probe messages have been echoed back and a sample measurement is taken for each one, the client should compute an estimate of the mean (average) RTT or mean throughput, depending on the type of measurement being performed. A detailed description of the probe messages format is provided in the description of the Measurement Phase.

MSG SIZE (MESSAGE SIZE): Specifies the number of bytes in the probes payload.

SERVER DELAY: Specifies the amount of time that the server should wait be- fore echoing the message back to the client. The default value should be 0. You will vary this value later to emulate paths with longer propagation delays. Even though increasing the server delay merely increases the processing time at the server, it nevertheless causes the feedback delay, observed by the sender, to in- crease, which has an effect somewhat similar to increasing the paths propagation delay.

WS: A single white space to separate the different fields in the message. The white space could serve as a delimiter for the server when parsing or tokenizing the received message.

The last is a new line character that indicates the end of the message.

CSP: Server. The server should parse the connection setup message to log the values of all the variables therein since they will be needed for error checking purposes. Upon the reception of a valid connection setup message, the server should respond with a text message containing the string 200 OK: Ready informing the client that it can proceed to the next phase. On the other hand, if the connection setup message is incomplete or invalid, the server should respond with a text message containing the string 404 ERROR: Invalid Connection Setup Message and then terminate the connection.

CSP: Summary. During correct operation, after setting up a TCP connection to the server, the client sends a single connection setup message to the server. The server parses and logs the information in the message and responds with a 200 OK: Ready text message informing the client to proceed to the next phase.

2. Measurement Phase (MP). In this phase, the client starts sending probe messages to the server in order to make the appropriate measurements required for computing the mean RTT or the mean throughput of the path connecting it to the server. We will outline the expected behavior from both the client and the server next.

MP: Client. The client should send the specified number of probe messages to the server with an increasing sequence number starting from 1. More specifically, the message format is as follows:

PROTOCOL PHASE: The protocol phase when conducting the measurements will be denoted by the lower case character m.

PROBE SEQUENCE NUMBER: The probe messages should have increasing sequence numbers starting from 1 up to the number of probes specified in the connection setup message using the NUMBER OF PROBES variable.

PAYLOAD: This is the probes payload and can be any arbitrary text whose size was specified in the connection setup message using the MESSAGE SIZE variable.

MP: Server. The server should echo back every probe message received. It should also keep track of the probe sequence numbers to make sure they are indeed being incremented by 1 each time and do not exceed the number of probes specified in the connection setup phase. If the probe message is incomplete or invalid (contains an incorrect sequence number for example) the server should not echo the message back. Instead, the server should respond with a text message containing the string 404 ERROR: Invalid Measurement Message and then terminate the connection.

MP: Summary. The client repeatedly sends measurement messages to the server in an attempt to compute the mean RTT and/or mean throughput. A sample measure- ment is taken for each probe sent out. The server repeatedly echoes messages back to the client unless it detects erroneous behavior in which case it sends an error message and terminates the connection.

3. Connection Termination Phase (CTP). In this phase, the client and the server attempt to gracefully terminate the connection. We will outline the expected behavior from both the client and the server next.

CTP: Client. The client should send a termination request to the server and then wait for a response (unless of course the server already terminated the connection due to an error in the Measurement Phase). Once a response is received, the client should terminate the connection. The message format is as follows:

PROTOCOL PHASE: The protocol phase when terminating the connection will

be denoted by the lower case character t.

CTP: Server. If the message format is correct, the server should respond with a text message containing the string 200 OK: Closing Connection. Otherwise, the

server should respond with a text message containing the string 404 ERROR: In- valid Connection Termination Message. Either way the server should terminate the connection.

CTP: Summary During correct operation, the client sends a termination message, the server responds with 200 OK: Closing Connection text message and then both terminate the connection.

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!