QuestionQuestion

For the second programming assignment you will be implementing a simple reliable transport protocol. The protocol will be unidirectional. Host A will be sending segments, and Host B will be receiving and acknowledging those segments, but Host B will not be sending any application data of its own. Host A is the sender, Host B is the receiver.

1. First, read section 3.4.1 – "Building a Reliable Data Transfer Protocol" of Kurose and Ross, Computer Networking: A Top-Down Approach. You will be implementing the Alternating Bit protocol, which they call rdt3.0.
2. Read the directions, descriptions, and suggestions in the attached assignment description from the textbook authors carefully.
3. Examine the file prog2.c carefully. All of your code will be added to this file to fill in the function stubs. That is how you will implement rdt3.0 as a part of this network simulation program.
4. You must implement the following functions in prog2.c, please read their descriptions in the assignment description carefully.
a. A_init
b. A_output
c. A_input
d. A_timerinterrupt
e. B_init
f. B_input
5. Do not implement either B_output or B_timerinterrupt. Those functions are only required for a bi-directional version of the protocol. Please ignore these two function stubs.
6. Your implementation should include some output to STDOUT describing events that occur and protocol actions that are taken during the simulation. For example, message arrival, packet arrival, timer interrupt, or data corruption detection, etc. should all be reported to STDOUT. In addition, describe the actions your functions take in response. For example, building a packet, sending a packet, retransmitting a message, restarting the timer, etc. Part of your submission will be a trace of your program—we need output for the trace.
7. Submit your source code, which should consist of a single file—your modified prog2.c
8. Submit a README that briefly explains your strategy for implementing each of the functions required rdt3.0.
9. Submit a trace of your completed program running to the point where about 10 messages have been sent and correctly acknowledged. Use the following settings: loss probability of 0.1, corruption probability of 0.3, and a trace level of 2. You can use screenshots, or you can redirect the output to a file. You might want to annotate your trace to indicate where interesting things happened (e.g., recovery from packet loss or packet corruption).

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

#define BIDIRECTIONAL 0   
                           
/* a "msg" is the data unit passed from layer 5 (teachers code) to layer */
/* 4 (students' code). It contains the data (characters) to be delivered */
/* to layer 5 via the students transport level protocol entities.         */
struct msg {
char data[20];
};

/* a packet is the data unit passed from layer 4 (students code) to layer */
/* 3 (teachers code). Note the pre-defined packet structure, which all   */
/* students must follow. */
struct pkt {
   int seqnum;
   int acknum;
   int checksum;
   char payload[20];
    };

void starttimer(int AorB, float increment);
void stoptimer(int AorB);
void tolayer3(int AorB, struct pkt packet);
void tolayer5(int AorB, char datasent[20]);

/********* STUDENTS WRITE THE NEXT SEVEN ROUTINES *********/

#define SWAP(x) (x == 0 ? 1 : 0)

#define A_B_RTT 15

int A_seq;
int A_waiting_ack;
struct pkt A_last_packet;

int B_seq;
int B_waiting_ack;
struct pkt B_last_packet;

/* calculate the checksum of a packet */
/* this is done by doing summation of all the bits in the packet */
int calculate_checksum(struct pkt *packet){
    int cs = 0;
    cs += packet->seqnum;
    cs += packet->acknum;
    for (int i = 0; i < 20; ++i)
       cs += packet->payload[i];
    return cs;
}...

By purchasing this solution you'll be able to access the following files:
Solution.c.

$65.25
for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available C-Family Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats