From 0ed9a573ffa2f01ca1b6a15c0e01bd928966d517 Mon Sep 17 00:00:00 2001 From: Jiaxing Yang Date: Tue, 31 Aug 2021 22:57:22 -0400 Subject: [PATCH 1/3] Assignment-1 released --- Assignments/Assignment-1/README.md | 281 ++++++++++++++++++ .../Assignment-1/assignment1_topology.png | Bin 0 -> 129866 bytes .../Assignment-1/starter_code/281Makefile.txt | 218 ++++++++++++++ .../Assignment-1/starter_code/answers.txt | 23 ++ .../starter_code/assignment1_topology.py | 61 ++++ 5 files changed, 583 insertions(+) create mode 100644 Assignments/Assignment-1/README.md create mode 100644 Assignments/Assignment-1/assignment1_topology.png create mode 100644 Assignments/Assignment-1/starter_code/281Makefile.txt create mode 100644 Assignments/Assignment-1/starter_code/answers.txt create mode 100755 Assignments/Assignment-1/starter_code/assignment1_topology.py diff --git a/Assignments/Assignment-1/README.md b/Assignments/Assignment-1/README.md new file mode 100644 index 0000000..84c20a5 --- /dev/null +++ b/Assignments/Assignment-1/README.md @@ -0,0 +1,281 @@ +# Assignment 1: Sockets, Mininet, & Performance + +### Due: Sep 22, 2021, 11:59 PM + +## Overview + +`iPerf` is a common tool used to measure network bandwidth. You will write your own version of this tool in C/C++ using sockets. You will then use your tools to measure the performance of virtual networks in Mininet and explain how link characteristics and multiplexing impact performance. + +* [Part 1](#part1): Write `iPerfer` +* [Part 2](#part2): Mininet Tutorial +* [Part 3](#part3): Measurements in Mininet +* [Part 4](#part4): Create a Custom Topology +* [Submission Instructions](#submission-instr) +* [Autograder](#autograder) + +Before you start doing anything with this project, however, please [register your github username with us](https://docs.google.com/forms/d/e/1FAIpQLSdYfoGeP9YbMOsxFrOWM03YXNRArSppqQ3RqNKIp0fFHgyKbQ/viewform?usp=sf_link) if you have not done so yet. This is so that we can create a private repository for you to store your code and answers for this project. + +## Learning Outcomes + +After completing this programming assignment, students should be able to: + +* Write applications that use sockets to transmit and receive data across a network +* Explain how latency and throughput are impacted by link characteristics and multiplexing + + +## Part 1: Write `iPerfer` + +For the first part of the assignment you will write your own version of `iPerf` to measure network bandwidth. Your tool, called `iPerfer`, will send and receive TCP packets between a pair of hosts using sockets. + +> **NOTE:** You may refer to [Beej's Guide to Network Programming Using Internet Sockets](https://beej.us/guide/bgnet/html/) for socket programming. Discussion sections will also review the some of the basics. + +When operating in client mode, `iPerfer` will send TCP packets to a specific host for a specified time window and track how much data was sent during that time frame; it will calculate and display the bandwidth based on how much data was sent in the elapsed time. When operating in server mode, `iPerfer` will receive TCP packets and track how much data was received during the lifetime of a connection; it will calculate and display the bandwidth based on how much data was received and how much time elapsed during the connection. + +### Server Mode + +To operate `iPerfer` in server mode, it should be invoked as follows: + +`./iPerfer -s -p ` + +* `-s` indicates this is the `iPerfer` server which should consume data +* `listen_port` is the port on which the host is waiting to consume data; the port should be in the range `1024 ≤ listen_port ≤ 65535` + +> For simplicity, you can assume these arguments will appear exactly in the order listed above. + +You can use the presence of the `-s` option to determine `iPerfer` should operate in server mode. + +If arguments are missing or extra arguments are provided, you should print the following and exit: + +`Error: missing or extra arguments` + +If the listen port argument is less than 1024 or greater than 65535, you should print the following and exit: + +`Error: port number must be in the range of [1024, 65535]` + +When running as a server, `iPerfer` must listen for TCP connections from a client and receive data as quickly as possible. It should then wait for some kind of message from the client indicating it is done sending data (we will call this a FIN message). The server should then send the client an acknowledgement to this FIN message. It is up to you to decide the format of these FIN and acknowledgement messages. + +Data should be read in chunks of 1000 bytes. Keep a running total of the number of bytes received. + +After the client has closed the connection, `iPerfer` server must print a one-line summary in the following format: + +`Received=X KB, Rate=Y Mbps` + +where X stands for the total number of bytes received (in kilobytes), and Y stands for the rate at which traffic could be read in megabits per second (Mbps). +Note X should be an integer and Y should be a decimal with three digits after the decimal mark. + +For example: +`Received=6543 KB, Rate=5.234 Mbps` + +The `iPerfer` server should shut down gracefully after it handles one connection from a client. + +> **Note:** Please use setsockopt to allow reuse of the port number, this will make your life easier for testing and will allow you to pass the autograder, which runs the `iPerfer` server with the same port number each time. <- We recognize this isn't ideal, and will be fixed in the future. + +### Client Mode + +To operate `iPerfer` in client mode, it should be invoked as follows: + +`./iPerfer -c -h -p -t