Question
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 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;
}
This is only a preview of the solution.
Please use the purchase button to see the entire solution.
By purchasing this solution you'll be able to access the following files:
Solution.c
Purchase Solution
$65.25
Google Pay
Amazon
Paypal
Mastercard
Visacard
Discover
Amex
View Available Computer Science Tutors 641 tutors matched
Ionut
(ionut)
Master of Computer Science
Hi! MSc Applied Informatics & Computer Science Engineer. Practical experience in many CS & IT branches.Research work & homework
5/5 (6,804+ sessions)
1 hour avg response
$15-$50 hourly rate
Pranay
(math1983)
Doctor of Philosophy (PhD)
Ph.D. in mathematics and working as an Assistant Professor in University. I can provide help in mathematics, statistics and allied areas.
4.6/5 (6,691+ sessions)
1 hour avg response
$40-$50 hourly rate
Leo
(Leo)
Doctor of Philosophy (PhD)
Hi! I have been a professor in New York and taught in a math department and in an applied math department.
4.9/5 (6,439+ sessions)
2 hours avg response

Similar Homework Solutions