Computer Network代写|IT代写

 CS 535 Computer Network 代写案例


In this assignment, you will first write a program that uses the socket interface to send messages between a pair of processes on different machines, namely, a client and a server. This first part will familiarize you with basic socket programming if you have not been exposed to it before. Then, you will use this program to measure the round trip time and throughput of a TCP connection between the client and the server. The second part of the assignment is meant to introduce you to basic network measurements.

Part I: Writing an Echo Client-Server Application Overview

For this part, you will implement a client and a server that communicate over the network using TCP. The server is essentially an echo server, which simply echoes the message it receives from the client. Here is what the server and client must do:

  • ●  The server should accept, as a command line argument, a port number that it will run at.

    To run your server on our csa1, csa2, or csa3.bu.edu, we have opened up ports 58000-58999 so please pick a port in this range for your server. After being started, the server should repeatedly accept an input message from a client and send back the same message.

  • ●  The client should accept, as command line arguments, a host name (or IP address), as well as a port number for the server. Using this information, it creates a connection (using TCP) with the server, which should be running already. The client program then sends a message (text string) to the server using the connection. When it receives back the message, it prints it and exits.

    In Part I, the message is simply a text string with no specific format. In other words, any text message will do. You may use C, C++, Java, or Python to build your client and server programs. In C/C++, you should familiarize yourselves with the following system calls: socket(), bind(), listen(), accept(), connect(), send() and recv(). We outline a number of resources below with additional information on these system calls, as well as their equivalent in several other programming languages.

    What to turn in: The programs you submit should work correctly and be well documented with a record of the information exchanged between your client and server. It would be a good idea to test your client program with the server program implemented by your teammate (or a classmate if you are working individually), or vice versa. This is possible because your programs should adhere to the same exchange protocol described above (and below for the second part of this assignment). This is also an interesting way to see how protocol entities can "interoperate" if they accurately implement the same protocol specification. You (or your team of two) must, however, implement both the client and server on your own.

    See the syllabus handout for guidelines on electronic submission using gsubmit to submit your Part I client and server programs under a “pa1part1” folder. You need to submit your documentation on Gradescope.

    Notes:

    • ●  You can develop your programs on non-CS machines, however, you ultimately need to port and test your programs on our CS Linux machines (i.e., csa1, csa2 or csa3.bu.edu) to ensure they will be graded correctly.

    • ●  This primer (http://www.cis.temple.edu/%7Eingargio/old/cis307s96/readings/docs/sockets.html) is an excellent introduction to BSD sockets. A good book (http://www.kohala.com/start/unpv12e.html) is also available on this topic.

    • ●  If you are using Java, you may look at these tutorials: https://docs.oracle.com/javase/tutorial/networking/sockets/index.html or https://www.baeldung.com/a-guide-to-java-sockets

    • ●  Additional socket programming links:

    o Network Programming with Sockets (http://www.lowtek.com/sockets/)

    ● Last but not least, if you are using Python, see the K&R textbook on socket programming and Python examples.

    Part II: Performing RTT and Throughput Measurements 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><WS><MEASUREMENT TYPE><WS><NUMBER OF PROBES><WS><MESSAGE SIZE><WS><SERVER DELAY>\n

    • ●  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.

    • ●  MEASUREMENT TYPE: Allows the client to specify whether it wants to compute the RTT, denoted by "rtt", or the throughput, denoted by "tput".

    • ●  NUMBER OF 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 message's format is provided in the description of the Measurement Phase.

    • ●  MESSAGE SIZE: Specifies the number of bytes in the probe's payload.

    • ●  SERVER DELAY: Specifies the amount of time that the server should wait before echoing the message back to the client. The default value is 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 increase, which has an effect somewhat similar to increasing the path's 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.

    • ●  ‘\n’: A new line character 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><WS><PROBE SEQUENCE NUMBER><WS><PAYLOAD>\n

      • ●  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 probe’s 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 measurement 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>\n

      ● 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: Invalid 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.


      What to turn in:
      Turn in a brief (1-2 page) description of your experiments and a summary of the results, along with two graphs: one for TCP's round trip time as a function of message (probe’s payload) size, and one for TCP throughput as a function of message size1. When generating these plots, the SERVER DELAY should be set to the default value 0. Then, vary the SERVER DELAY parameter, and comment on how/why varying the SERVER DELAY parameter affects the shape of the plots. You may include up to two additional plots, for different SERVER DELAY values, to support your comments conclusions.

      Follow guidelines on using gsubmit to electronically turn in your data files that you used to produce your plots, besides your Part II client and server program listings. Use Gradescope to submit your documentation.

      Notes:

      • ●  Make sure to report throughput numbers (e.g., 500 kbps) and not just the amount of time it takes to exchange some number of bytes.

      • ●  Give a thorough description of your experiments, including the location of your client machine (e.g., home or csa1.bu.edu), what kind of machines (e.g. the names of the CS Linux machines you used), operating systems, network, statistics collection method (including how many times an experiment was repeated, i.e. number of probes for a certain payload’s size, before the average is taken), etc.

      • ●  You may use the gettimeofday() system call or something similar to get the time.

      • ●  To draw graphs, you can use any plotting program you like. 



咨询 Alpha 小助手,获取更多课业帮助