CS447-Network and Data Communication Project #2 Specification, Fall 2017 Due December 5, 2017 1. Introduction In this project, we will develop a Sliding-Window flow-control (SWFC) simulator using C/C++ by completing the base source code file ( WS_base.cpp ). The simulator should calculate: the transmission start time at a sender host, the transmission completion time at a sender host, the packet receive time at a receiver, and the ACK receive time at a sender host for each packet transmitted from a sender to a receiver host, as defined below. At the end of each simulation, your SWFC simulator should display the time for the four factors, as well as the total time. The simulator calculates the time in ns (nano-second) order. This project assumes Visual C++ coding environment. The transmission start time: the time a sender host starts transmitting a packet The transmission completion time: the time a sender host completes the transmission of a packet The packet receive time: the time a receiver host receives (i.e., finishes receiving a packet) The ACK receive time: the time a sender host receives the ACK for a packet it transmitted For example, the following sketch shows transmissions of seven packets from a sender to a receiver host when: Signal Propagation Speed (ns per mile): 4,000 Packet Size (in bits): 6,400 Transmission Rate (in bps): 100,000,000 (= 100 Mbps) Transmission Distance (in miles): 1,000 Window Size: 5 With the following assumptions: 1. All the packets transmitted by the sender is equal size. 2. Ignore the size of the ACK message ( 0 ns for transmitting an ACK) 3. No error (packets or ACK messages will never be lost and each of them is always correctly delivered) Sender 0 64,000 128,000 192,000 256,000 320,000 8,064,000 Transmission Distance Receiver Signal Propagation Delay 4,064,000 4,128,000 4,192,000 4,256,000 4,320,000 1 0 64,000 4,064,000 8,064,000 2 64,000 128,000 4,128,000 8,128,000 3 128,000 192,000 4,192,000 8,192,000 4 192,000 256,000 4,256,000 8,256,000 5 256,000 320,000 4,320,000 8,320,000 6 8,064,000 8,128,000 12,128,000 16,128,000 7 8,128,000 8,192,000 12,192,000 16,192,000 8 9 8,128,000 8,192,000 12,128,000 12,192,000 Packet Transmission Delay 16,128,000 Note: the time is shown in ns Fig. 1 Definitions for the time factors your SWFC simulator needs calculate 1
Fig. 2 shows a sample output for Case 3 (see the definition for Case 3 ): Sig. Prop. Speed (ns per mile): 4,000 Pkt Size (in bits): 6,400 Tx Rate (in bps): 100,000,000 Tx Distance (in miles) 100 TP (in ns): 400,000 TF (in ns): 64,000 Window Size: 15 Packets transferred 32 1 0 64,000 464,000 864,000 2 64,000 128,000 528,000 928,000 3 128,000 192,000 592,000 992,000 4 192,000 256,000 656,000 1,056,000 5 256,000 320,000 720,000 1,120,000 6 320,000 384,000 784,000 1,184,000 7 384,000 448,000 848,000 1,248,000 8 448,000 512,000 912,000 1,312,000 9 512,000 576,000 976,000 1,376,000 10 576,000 640,000 1,040,000 1,440,000 11 640,000 704,000 1,104,000 1,504,000 12 704,000 768,000 1,168,000 1,568,000 13 768,000 832,000 1,232,000 1,632,000 14 832,000 896,000 1,296,000 1,696,000 15 896,000 960,000 1,360,000 1,760,000 16 960,000 1,024,000 1,424,000 1,824,000 17 1,024,000 1,088,000 1,488,000 1,888,000 18 1,088,000 1,152,000 1,552,000 1,952,000 19 1,152,000 1,216,000 1,616,000 2,016,000 20 1,216,000 1,280,000 1,680,000 2,080,000 21 1,280,000 1,344,000 1,744,000 2,144,000 22 1,344,000 1,408,000 1,808,000 2,208,000 23 1,408,000 1,472,000 1,872,000 2,272,000 24 1,472,000 1,536,000 1,936,000 2,336,000 25 1,536,000 1,600,000 2,000,000 2,400,000 26 1,600,000 1,664,000 2,064,000 2,464,000 27 1,664,000 1,728,000 2,128,000 2,528,000 28 1,728,000 1,792,000 2,192,000 2,592,000 29 1,792,000 1,856,000 2,256,000 2,656,000 30 1,856,000 1,920,000 2,320,000 2,720,000 31 1,920,000 1,984,000 2,384,000 2,784,000 32 1,984,000 2,048,000 2,448,000 2,848,000 2
Fig. 2 Sample outputs from SWFC Simulator 2. Requirements Your SWFC simulator should satisfy the following requirements: (a) Each of you must develop your SWFC simulator based on the provided base source code file. The only three sections of the source code file you can change are (please find the three sections in the base source code file ): - // YOUR CUSTOM-MADE FUNCTION PROTOTYPES - // BELOW IS YOUR WORK PLACE - // YOUR CUSTOM-MADE FUNCTIONS The base source code file is available at the CS447 course home. After you submitted your *.cpp source code file, the course TA will copy and paste your work in the three sections to the base source code file before it is tested. (b) All the outputs from your SWFC simulator should be made by display_results function in the base source code file. (c) Assume that every packet the sender host transmits is equal in the packet size (in bits). (d) Assume that each ACK message the receiver host transmits to the sender host is 0 bit (thus the transmission time for each ACK message is 0 ns however the propagation delay is not 0). 3
(e) The following outputs from your SWFC simulator should be correct. Some sample outputs are attached to this handout for debug use. the transmission start time at the sender host (for each packet) the transmission completion time at the sender host (for each packet) the packet receive time at the receiver host (for each packet) the ACK receive time at the sender host (for each packet) the completion time (for all the packets) (f) Your source code (*.cpp file) should be compiled by MS Visual C++ compiler. (g) At the beginning of your *.cpp source code file, specify your full name and SIUE 800- ID number. (h) This programming project is an individual project. No source code sharing or no collaborations for designing your SWFC simulator is allowed. Violation to these policy will be considered academic dishonesty. 3. Technical Hints and Suggested Program Organization (a) The primary data structures in your SWFC simulator are the three vectors (arrays) of type long long unsigned int, which means a 64-bit unsigned integer (because they are used to record time stamps in ns order) as defined in the followings: long long unsigned int * transmission_at_sender; long long unsigned int * ACK_at_sender; long long unsigned int * receive_at_receiver; Each of the three arrays are dynamically created after a user enters the number of the packets to be transferred by the sender host (and received by the receiver host). When they are dynamically created by calloc, they are initialized by all 0.00. The contents of the three arrays should be filled, one packet at a time by your SWFC simulator. (b) The other major variable in your SWFC simulator are: long long unsigned int simulation_time; // simulation time in "nano second" long long unsigned int simulation_completion_time; // simulation time unsigned int num_completed_pkt; // the number of packets completed unsigned int window_size; // the common window size unsigned int sdr_window_size; // the open window size at the sender unsigned int rcvr_window_size; // the open window size at the receiver In the base source code file, any variables for keeping track of the number of packets are declared as type unsigned int (a 32-bit unsigned integer, covering up to 4,294,967,296 packets), while any variables for keeping track of time is declared as long long unsigned int (a 64-bit unsigned integer, covering up to 18,446,744,073,709,551,616 nano second, which is approximately 18,446,744,073 seconds). (c) There are five global variables, in which the following four are used just for calculating the window size (thus, you do not use them for your work): long long unsigned int sig_prop_delay; // signal propagation delay in ns long long unsigned int pkt_transmission_delay; // packet transmission delay in "ns unsigned int TX_BW; // transmission bandwidth unsigned int distance; // transmission (end-to-end) distance The only important global variable to you is: 4
unsigned int num_packets_tx; // the number of packets to transfer The variable (num_packets_tx) is declared as a global variable because, once a value is assigned to it in the beginning of the simulator, it should never be modified by any function. (d) The following figure (Fig. 3) shows a suggested program structure for your SWFC simulator (it s just a suggestion but not a requirement if you have a better idea, go for it!). program starts (simulation time = 0) Is there a new ACK message received * 1 NO Is the window size at the sender is more than 0?* 1 YES YES NO Increase the window size the sender by one Advance the simulation time to the next earliest ACK at the sender Calculate,, and for the next packet to transmit and save them to the arrays Increase the # of the packets completed by one the transmission completion time ( transmission_at_sender[i] ) the packet receive time ( receive_at_receiver[i] ) the ACK receive time ( ACK_at_sender[i] ) NO Have all the packets been transmitted? YES Display the contents of the three arrays (and time) 4. Expectations when a question is asked: Fig. 3 Suggested SWFC simulator organization (1) Describe the symptom(s) of the problem you observed as specific as possible (2) Describe how the problem happens (always happen, sometime happen, the condition(s) for the problem to happen, etc.) (3) Identify where (in your source code) the problem exists in your source code file(s) (4) Describe what you tried (to understand and/or solve the problem) (5) Stop by Dr. Fujinoki s office (no question through e-mail). (6) Make sure to bring your source code (either hard copy or soft copy) (7) Although Dr. Fujinoki may give you some advices, Dr. Fujinoki will not debug your source code (i.e., debugging for compilation (especially syntax errors and any other issues that prevent you from a successful compilation of your *.cpp source code file) are your job). 5
5. Grading Criteria: (a) No flow control (packets are contiguously transmitted without flow-control): 35% of the credit (b) For cases where window size is not large enough to reach U = 100% (Case #1, #2, and #3): 70% (c) For cases where window size is large enough to reach U = 100% (Case #4): 100% Note: the number of packets to be simulated should be up to 1,000 packets 6. Submissions Please e-mail your *.cpp file to Dr. Fujinoki for the earliest possible deadline below: (a) Extra-credit internal deadline: November 25th (Friday, 11:11:59 PM) (+4 points to your final exam) (b) Free feedback internal deadline: December 1st (Friday, 11:11:59 PM) (c) Hard deadline: December 5th (Tuesday, 11:00:00 AM) 7. Rules to avoid academic dishonesty (a) Sharing source code file(s) or sharing ideas is considered academic dishonesty 8. Other issues Note: If you have anything you are not sure, please do not make your own assumptions. If you are making your own assumptions for anything you are not sure, please be responsible for your own assumptions (Dr. Fujinoki will not be responsible for your assumptions). Remember: asking a question is free (no matter what is your question) and once you got an answer from Dr. Fujinoki, Dr. Fujinoki will be responsible for whatever answer he gave to you. For those who have technical problems to finish this project, please consult to Dr. Fujinoki as soon as possible. Your submitted work will be graded using another test case ( Case 5 and Case 6 ). 6
Sig. Prop. Speed (ns per mile): 4,000 Pkt Size (in bits): 6,400 Tx Rate (in bps): 100,000,000 Tx Distance (in miles) 1,000 Test Case #1 TP (in ns): 4,000,000 TF (in ns): 64,000 Window Size: 5 Packets transferred 32 1 0 64,000 4,064,000 8,064,000 2 64,000 128,000 4,128,000 8,128,000 3 128,000 192,000 4,192,000 8,192,000 4 192,000 256,000 4,256,000 8,256,000 5 256,000 320,000 4,320,000 8,320,000 6 8,064,000 8,128,000 12,128,000 16,128,000 7 8,128,000 8,192,000 12,192,000 16,192,000 8 8,192,000 8,256,000 12,256,000 16,256,000 9 8,256,000 8,320,000 12,320,000 16,320,000 10 8,320,000 8,384,000 12,384,000 16,384,000 11 16,128,000 16,192,000 20,192,000 24,192,000 12 16,192,000 16,256,000 20,256,000 24,256,000 13 16,256,000 16,320,000 20,320,000 24,320,000 14 16,320,000 16,384,000 20,384,000 24,384,000 15 16,384,000 16,448,000 20,448,000 24,448,000 16 24,192,000 24,256,000 28,256,000 32,256,000 17 24,256,000 24,320,000 28,320,000 32,320,000 18 24,320,000 24,384,000 28,384,000 32,384,000 19 24,384,000 24,448,000 28,448,000 32,448,000 20 24,448,000 24,512,000 28,512,000 32,512,000 21 32,256,000 32,320,000 36,320,000 40,320,000 22 32,320,000 32,384,000 36,384,000 40,384,000 23 32,384,000 32,448,000 36,448,000 40,448,000 24 32,448,000 32,512,000 36,512,000 40,512,000 25 32,512,000 32,576,000 36,576,000 40,576,000 26 40,320,000 40,384,000 44,384,000 48,384,000 27 40,384,000 40,448,000 44,448,000 48,448,000 28 40,448,000 40,512,000 44,512,000 48,512,000 29 40,512,000 40,576,000 44,576,000 48,576,000 30 40,576,000 40,640,000 44,640,000 48,640,000 31 48,384,000 48,448,000 52,448,000 56,448,000 32 48,448,000 48,512,000 52,512,000 56,512,000 60,000,000 50,000,000 40,000,000 30,000,000 20,000,000 10,000,000 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 Start Time Tx Time Receive Time ACK Time 7
Sig. Prop. Speed (ns per mile): 4,000 Pkt Size (in bits): 6,400 Tx Rate (in bps): 100,000,000 Tx Distance (in miles) 100 Test Case #2 TP (in ns): 400,000 TF (in ns): 64,000 Window Size: 10 Packets transferred 32 1 0 64,000 464,000 864,000 2 64,000 128,000 528,000 928,000 3 128,000 192,000 592,000 992,000 4 192,000 256,000 656,000 1,056,000 5 256,000 320,000 720,000 1,120,000 6 320,000 384,000 784,000 1,184,000 7 384,000 448,000 848,000 1,248,000 8 448,000 512,000 912,000 1,312,000 9 512,000 576,000 976,000 1,376,000 10 576,000 640,000 1,040,000 1,440,000 11 864,000 928,000 1,328,000 1,728,000 12 928,000 992,000 1,392,000 1,792,000 13 992,000 1,056,000 1,456,000 1,856,000 14 1,056,000 1,120,000 1,520,000 1,920,000 15 1,120,000 1,184,000 1,584,000 1,984,000 16 1,184,000 1,248,000 1,648,000 2,048,000 17 1,248,000 1,312,000 1,712,000 2,112,000 18 1,312,000 1,376,000 1,776,000 2,176,000 19 1,376,000 1,440,000 1,840,000 2,240,000 20 1,440,000 1,504,000 1,904,000 2,304,000 21 1,728,000 1,792,000 2,192,000 2,592,000 22 1,792,000 1,856,000 2,256,000 2,656,000 23 1,856,000 1,920,000 2,320,000 2,720,000 24 1,920,000 1,984,000 2,384,000 2,784,000 25 1,984,000 2,048,000 2,448,000 2,848,000 26 2,048,000 2,112,000 2,512,000 2,912,000 27 2,112,000 2,176,000 2,576,000 2,976,000 28 2,176,000 2,240,000 2,640,000 3,040,000 29 2,240,000 2,304,000 2,704,000 3,104,000 30 2,304,000 2,368,000 2,768,000 3,168,000 31 2,592,000 2,656,000 3,056,000 3,456,000 32 2,656,000 2,720,000 3,120,000 3,520,000 4,000,000 3,500,000 3,000,000 2,500,000 2,000,000 1,500,000 1,000,000 500,000 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 Start Time Tx Time Receive Time ACK Time 8
Sig. Prop. Speed (ns per mile): 4,000 Pkt Size (in bits): 6,400 Tx Rate (in bps): 100,000,000 Tx Distance (in miles) 100 Test Case #3 TP (in ns): 400,000 TF (in ns): 64,000 Window Size: 15 Packets transferred 32 1 0 64,000 464,000 864,000 2 64,000 128,000 528,000 928,000 3 128,000 192,000 592,000 992,000 4 192,000 256,000 656,000 1,056,000 5 256,000 320,000 720,000 1,120,000 6 320,000 384,000 784,000 1,184,000 7 384,000 448,000 848,000 1,248,000 8 448,000 512,000 912,000 1,312,000 9 512,000 576,000 976,000 1,376,000 10 576,000 640,000 1,040,000 1,440,000 11 640,000 704,000 1,104,000 1,504,000 12 704,000 768,000 1,168,000 1,568,000 13 768,000 832,000 1,232,000 1,632,000 14 832,000 896,000 1,296,000 1,696,000 15 896,000 960,000 1,360,000 1,760,000 16 960,000 1,024,000 1,424,000 1,824,000 17 1,024,000 1,088,000 1,488,000 1,888,000 18 1,088,000 1,152,000 1,552,000 1,952,000 19 1,152,000 1,216,000 1,616,000 2,016,000 20 1,216,000 1,280,000 1,680,000 2,080,000 21 1,280,000 1,344,000 1,744,000 2,144,000 22 1,344,000 1,408,000 1,808,000 2,208,000 23 1,408,000 1,472,000 1,872,000 2,272,000 24 1,472,000 1,536,000 1,936,000 2,336,000 25 1,536,000 1,600,000 2,000,000 2,400,000 26 1,600,000 1,664,000 2,064,000 2,464,000 27 1,664,000 1,728,000 2,128,000 2,528,000 28 1,728,000 1,792,000 2,192,000 2,592,000 29 1,792,000 1,856,000 2,256,000 2,656,000 30 1,856,000 1,920,000 2,320,000 2,720,000 31 1,920,000 1,984,000 2,384,000 2,784,000 32 1,984,000 2,048,000 2,448,000 2,848,000 3,000,000 2,500,000 2,000,000 1,500,000 1,000,000 500,000 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 Start Time Tx Time Receive Time ACK Time 9
Sig. Prop. Speed (ns per mile): 4,000 Pkt Size (in bits): 6,400 Tx Rate (in bps): 100,000,000 Tx Distance (in miles) 100 Test Case #4 TP (in ns): 400,000 TF (in ns): 64,000 Window Size: 5 Packets transferred 32 1 0 64,000 464,000 864,000 2 64,000 128,000 528,000 928,000 3 128,000 192,000 592,000 992,000 4 192,000 256,000 656,000 1,056,000 5 256,000 320,000 720,000 1,120,000 6 864,000 928,000 1,328,000 1,728,000 7 928,000 992,000 1,392,000 1,792,000 8 992,000 1,056,000 1,456,000 1,856,000 9 1,056,000 1,120,000 1,520,000 1,920,000 10 1,120,000 1,184,000 1,584,000 1,984,000 11 1,728,000 1,792,000 2,192,000 2,592,000 12 1,792,000 1,856,000 2,256,000 2,656,000 13 1,856,000 1,920,000 2,320,000 2,720,000 14 1,920,000 1,984,000 2,384,000 2,784,000 15 1,984,000 2,048,000 2,448,000 2,848,000 16 2,592,000 2,656,000 3,056,000 3,456,000 17 2,656,000 2,720,000 3,120,000 3,520,000 18 2,720,000 2,784,000 3,184,000 3,584,000 19 2,784,000 2,848,000 3,248,000 3,648,000 20 2,848,000 2,912,000 3,312,000 3,712,000 21 3,456,000 3,520,000 3,920,000 4,320,000 22 3,520,000 3,584,000 3,984,000 4,384,000 23 3,584,000 3,648,000 4,048,000 4,448,000 24 3,648,000 3,712,000 4,112,000 4,512,000 25 3,712,000 3,776,000 4,176,000 4,576,000 26 4,320,000 4,384,000 4,784,000 5,184,000 27 4,384,000 4,448,000 4,848,000 5,248,000 28 4,448,000 4,512,000 4,912,000 5,312,000 29 4,512,000 4,576,000 4,976,000 5,376,000 30 4,576,000 4,640,000 5,040,000 5,440,000 31 5,184,000 5,248,000 5,648,000 6,048,000 32 5,248,000 5,312,000 5,712,000 6,112,000 7,000,000 6,000,000 5,000,000 4,000,000 3,000,000 2,000,000 1,000,000 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 Start Time Tx Time Receive Time ACK Time CS447 Networks and Data Communications, Description of Project #2, Fall 2017 10