Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(sending and receiving transport-level code for implementing a simple reliable data transfer protocol) ONLY want the GBN version, protocol should be NAK free The protocol

(sending and receiving transport-level code for implementing a simple reliable data transfer protocol) ONLY want the GBN version, protocol should be NAK free The protocol should be able to handle an arbitrary number of packet transmissions from the sender. And the code should run with TRACE=1,2,3. Skeleton code is provided below.

#include

#include

/* ******************************************************************

ALTERNATING BIT AND GO-BACK-N NETWORK EMULATOR: VERSION 1.1 J.F.Kurose

This code should be used for PA2, unidirectional or bidirectional

data transfer protocols (from A to B. Bidirectional transfer of data

is for extra credit and is not required). Network properties:

- one way network delay averages five time units (longer if there

are other messages in the channel for GBN), but can be larger

- packets can be corrupted (either the header or the data portion)

or lost, according to user-defined probabilities

- packets will be delivered in the order in which they were sent

(although some can be lost).

**********************************************************************/

#define BIDIRECTIONAL 0 /* change to 1 if you're doing extra credit */

/* and write a routine called B_output */

/* 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];

};

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

//set the maximum size of

#define BUFFER_SIZE 50

int seqnum = 0;

int acknum = 0;

int intransit = 0;

struct pkt prevpkt;

int expectedseqnum = 0;

/* called from layer 5, passed the data to be sent to other side */

A_output(message)

struct msg message;

{

}

B_output(message) /* need be completed only for extra credit */

struct msg message;

{

}

/* called from layer 3, when a packet arrives for layer 4 */

A_input(packet)

struct pkt packet;

{

}

/* called when A's timer goes off */

A_timerinterrupt()

{

}

/* the following routine will be called once (only) before any other */

/* entity A routines are called. You can use it to do any initialization */

A_init()

{

}

/* Note that with simplex transfer from a-to-B, there is no B_output() */

/* called from layer 3, when a packet arrives for layer 4 at B*/

B_input(packet)

struct pkt packet;

{

}

/* called when B's timer goes off */

B_timerinterrupt()

{

}

/* the following routine will be called once (only) before any other */

/* entity B routines are called. You can use it to do any initialization */

B_init()

{

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2022 Grenoble France September 19 23 2022 Proceedings Part 4 Lnai 13716

Authors: Massih-Reza Amini ,Stephane Canu ,Asja Fischer ,Tias Guns ,Petra Kralj Novak ,Grigorios Tsoumakas

1st Edition

3031264118, 978-3031264115

More Books

Students also viewed these Databases questions

Question

Describe the Ribbon.

Answered: 1 week ago

Question

power language

Answered: 1 week ago

Question

Write a program to check an input year is leap or not.

Answered: 1 week ago

Question

Write short notes on departmentation.

Answered: 1 week ago

Question

What are the factors affecting organisation structure?

Answered: 1 week ago

Question

What are the features of Management?

Answered: 1 week ago

Question

Briefly explain the advantages of 'Management by Objectives'

Answered: 1 week ago

Question

6. What is process reengineering? Why is it relevant to training?

Answered: 1 week ago