Loading...

Messages

Proposals

Stuck in your homework and missing deadline? Get urgent help in $10/Page with 24 hours deadline

Get Urgent Writing Help In Your Essays, Assignments, Homeworks, Dissertation, Thesis Or Coursework & Achieve A+ Grades.

Privacy Guaranteed - 100% Plagiarism Free Writing - Free Turnitin Report - Professional And Experienced Writers - 24/7 Online Support

Go back n protocol simulation

29/11/2021 Client: muhammad11 Deadline: 2 Day

CSE422 Sec 002 – Computer Networking Fall 2018

1 Updated: 10/4/2018 9:40 AM

Project 2 – 100 points I m pl em ent at i on of Rel i abl e D at a Transfer P rot oc ol GBN

In this C programming assignment, you will complete the sending and receiving transport-level code for

a simple reliable data transfer protocol Go-Back-N. This assignment doesn't involve any socket

programming. Instead, your program for both sender and receiver will be implemented in a protocol

simulator provided in gbn.c. Your program will simulate the behavior of GBN as specified in the class

notes (some differences will be noted in the following). A skeleton file gbn.c is provided and you are

ONLY required to implement the blank functions listed in Section II of the file. The functions provided

in Section IV “Student-callable ROUTINES” of the file can be called by your functions.

Program Input The program takes three input parameters from stdin as follows:

• The number of messages to simulate: the number of messages from layer 5 that will be sent by

GBN.

• Time between messages from sender's layer5: the time duration between two messages from

layer 5. This value is usually smaller than the RTT which is set to 15 simulation time units.

• Channel pattern string: this string specifies the characteristics of the underlying channel. Each

character in the string specifies the action taken by the channel for a packet being transmitted.

Character ‘o’ indicates the packet will be received correctly

, ‘-’ indicates the packet will be corrupted

, ‘x’ indicates the packet will be lost.

• For example: a channel pattern string “xo-oxo” indicates that 1st packet will be lost, 2nd

received correctly, 3rd corrupted, 4th lost, and 5th received correctly. All the following packets will

then repeat the same pattern, i.e., 6th lost, 7th received correctly and so on. Note that you can

input different pattern string to test your program. Note that the sequence of the packets in

channel pattern refers to both data packets from sender to receiver and the ACK packets from

the receiver to sender. For example, the 1st packet is a data packet from sender to receiver, and

2nd packet may be ACK from receiver to sender (if the first data packet was not lost), 3rd packet

may be a data packet again, and so on. The length of channel pattern string input by the user

must be shorter than 40 characters.

• Sender’s window size: the number of packets that the sender keeps in its sending window. The

default value is 8.

• A single timer will be used for retransmitting all lost packets. To keep it simple, the timeout

should always be set to be RTT in your program whenever the timer is started. However, you are

allowed to set the timeout differently for earning bonus points (see 'Bonus Points' for details).

The accuracy of your program will be graded based on the results by different input parameters.

Formatted: Normal, Indent: Left: 0.8", No bullets or

numbering

Formatted: Normal, Indent: Left: 0.8"

Formatted: Normal, Indent: Left: 0.5"

CSE422 Sec 002 – Computer Networking Fall 2018

2 Updated: 10/4/2018 9:40 AM

Program Output The program outputs the important events during the execution of GBN. These events include:

Sent a packet: the sender passes the packet to layer 3.

Received an expected packet correctly: the receiver receives a packet with a sequence number that it

is expecting, and the packet’s checksum is correct. Receive a corrupted packet: the receiver receives a

packet with wrong checksum. Receive an unexpected packet correctly: the receiver receives a packet

with a correct checksum, but the sequence number is not what it is expecting.

Timeout: the timer of sender goes off.

Buffer packet: when the sender receives a packet from layer 5 while its sending window is full, it buffers

it in the buffer (defined by struct msg buffer[MAXBUFSIZE]; in the code).

The output of each event also includes important information such as current system time (which can

be obtained by calling currenttime()), the base of the sending window, packet sequence number and so

on. For example, the following two lines are excerpted from the output of the program:

[18.0]□A:□send□packet□[2]□base□[1]

………………………………….

[40.0]□A:□time□out, □resend□packets□[0□1□2□]

□ represents a space. Each line of output starts with current time and the node name

(A is sender and B is receiver, then the event (send/receive etc.), and packet sequence number if a

packet is involved, and the base of the sender’s window if this event is from sender. The following is the

complete output of the program when the channel is error-free (the input from the user is underlined),

window size is 2.

Enter the number of messages to simulate:

5

Enter time between messages from sender's layer5 [ > 0.0]:

5

Enter channel pattern string ooooooooooooooooooooo

Enter sender's window size

2

[5.0] A: send packet [0] base [0]

[10.0] A: send packet [1] base [0]

[11.5] B: packet [0] received, send ACK [0]

[15.0] A: buffer packet [2] base [0]

[16.5] B: packet [1] received, send ACK [1]

CSE422 Sec 002 – Computer Networking Fall 2018

3 Updated: 10/4/2018 9:40 AM

[18.0] A: ACK [0] received

[18.0] A: send packet [2] base [1]

[20.0] A: buffer packet [3] base [1]

[23.0] A: ACK [1] received

[23.0] A: send packet [3] base [2]

[24.5] B: packet [2] received, send ACK [2]

[25.0] A: buffer packet [4] base [2]

[29.5] B: packet [3] received, send ACK [3]

[31.0] A: ACK [2] received

[31.0] A: send packet [4] base [3]

[36.0] A: ACK [3] received

[37.5] B: packet [4] received, send ACK [4]

[44.0] A: ACK [4] received

Simulator terminated, [5] msgs sent from layer5

The following is the complete output of the program when the first packet is lost, fourth and fifth

corrupted by the channel (as specified by the channel pattern string), window size is 3.

Enter the number of messages to simulate:

5

Enter time between messages from sender's layer5 [ > 0.0]:

5

Enter channel pattern string

xoo--ooooooooooooooooooooooooo

Enter sender's window size

3

[5.0] A: send packet [0] base [0]

[10.0] A: send packet [1] base [0]

[15.0] A: send packet [2] base [0]

[16.5] B: packet [1] unexpected, send ACK [-1]

[20.0] A: time out, resend packets [0 1 2 ]

[20.0] A: buffer packet [3] base [0]

[21.5] B: packet [2] unexpected, send ACK [-1]

[23.0] A: ACK corrupted

[25.0] A: buffer packet [4] base [0]

[26.5] B: packet corrupted, send ACK [-1]

[26.5] B: packet [1] unexpected, send ACK [-1] [26.5] B: packet [2]

unexpected, send ACK [-1]

CSE422 Sec 002 – Computer Networking Fall 2018

4 Updated: 10/4/2018 9:40 AM

[28.0] A: ACK [-1] received

[33.0] A: ACK [-1] received

[33.0] A: ACK [-1] received

[33.0] A: ACK [-1] received

[35.0] A: time out, resend packets [0 1 2 ]

[41.5] B: packet [0] received, send ACK [0]

[41.5] B: packet [1] received, send ACK [1] [41.5] B: packet [2]

received, send ACK [2]

[48.0] A: ACK [0] received

[48.0] A: send packet [3] base [1]

[48.0] A: ACK [1] received

[48.0] A: send packet [4] base [2]

[48.0] A: ACK [2] received

[54.5] B: packet [3] received, send ACK [3] [54.5] B: packet [4]

received, send ACK [4]

[61.0] A: ACK [3] received

[61.0] A: ACK [4] received

Simulator terminated, [5] msgs sent from layer5

Walk Through To complete this project, you are ONLY required to implement the blank functions listed in Section II

of the skeleton file gbn.c. This file uses the following notation. Node A is the sender and B is the

receiver. “Layer 5” refers to the application layer that calls the functions of GBN protocol to send data.

“Layer 4” refers to the transport layer in which you implement the GBN protocol. “Layer 3” refers to the

network layer that calls the functions of GBN protocol when a new packet arrives. Each section of file

gbn.c is explained in the following.

• SECTION I: this section defines a few variables that can be used by the routines to be implemented.

You may define new global variables if necessary. However, you should reduce the number of new

global variables to the minimum. Excessive new global variables will result in point deduction (see

‘Grading’ for details).

The unit of data passed between the upper layers and your protocols is a message, which is declared

as:

struct msg {

char data[20];

};

Your sending entity will thus receive data 20 byte chunks from layer5; your receiving entity should

deliver 20 byte chunks of correctly received data to layer5 at the receiving side.

The unit of data passed between your routines and the network layer is the packet, which is

declared as:

CSE422 Sec 002 – Computer Networking Fall 2018

5 Updated: 10/4/2018 9:40 AM

struct pkt {

int seqnum;

int acknum;

int checksum;

char payload[20];

};

Your routines will fill in the payload field from the message data passed down from layer5-easy to

do with memcpy. The other packet fields will be used by your protocols to insure reliable delivery.

• Follow the checksum algorithm described in the class notes.

• SECTION II: this section contains ALL the functions that you need to complete in this project.

o ComputeChecksum( ): compute the checksum of the packet to be sent from the sender. Follow

the checksum algorithm described in the class notes. You can use whatever approach for

checksumming you want. We would suggest a TCP-like checksum, discussed in the class slides,

which consists of the sum of the (integer) sequence and ack field values, added to a character-

by-character sum of the payload field of the packet (i.e., treat each character as if it were an 8

bit integer and just add them together). Note that you need to include payload, sequence

number, and ACK number in the computation. The payload always has a fixed length of 20 (as

defined in the structure ‘struct msg’.)

o CheckCorrupted( ): check the checksum of the packet received, return TRUE if packet is

corrupted, FALSE otherwise.

o A_output( ): called by layer5 (application) to send data to the other side. Follow the FSM of the

GBN sender discussed in class. The basic logic flow of this function is described in the following.

Note that only important steps are discussed here and it’s your responsibility to ensure that

your code implements the correct logic of GBN and produces the correct results described in

Program Output. First, check if ‘nextseqnum’ falls within the sender window. If yes, create a

packet by filling in the payload (which is contained in the application message) and a proper

sequence number. As this is a data packet, set ACK number to ‘NOTUSED’. Compute checksum

and send out the packet by calling function tolayer3. Copy the packet to the buffer defined by

winbuf. If it is the first packet in window, start the timer. The timeout of the timer should be

set to RTT (which is defined in the file). If ‘nextseqnum’ does not fall within the sender window,

buffer the message if the sender message buffer is not full, exit otherwise (which typically will

not occur). Use buffer, buffront, bufrear, msgnum to buffer the sender messages.

o A_input( ): called from layer 3, when a packet arrives for layer 4. Follow the FSM of the GBN

sender discussed in class. The basic logic flow of this function is described in the following. Not e

that only important steps are discussed here and it’s your responsibility to ensure that your

code implements the correct logic of GBN and produces the correct results described in

Program Output. First, check if the packet is corrupted. If it is not, delete the acked packets

from window buffer, advance the window base pointer, and stop the timer. Start a new time if

Formatted: Left, Indent: Left: 0.25", Right: 0", Space

After: 8 pt, Line spacing: Multiple 1.08 li, No bullets or

numbering

CSE422 Sec 002 – Computer Networking Fall 2018

6 Updated: 10/4/2018 9:40 AM

there is still pending packets in the window that have not been acked. If the message buffer is

not empty (i.e., there are application messages waiting to be sent), create a new packet and

send it.

o A_timerinterrupt( ): called when A's timer goes off. Restart the timer and resend all packets not

acked.

o B_input( ): called from layer 3, when a packet arrives for layer 4 at receiver B. Follow the FSM

of the GBN receiver discussed in class. The basic logic flow of this function is described in the

following. Note that only important steps are discussed here and it’s your responsibility to

ensure that your code implements the correct logic of GBN and produces the correct results

described in Program Output. If the packet is not corrupted and is in order, create an ACK

packet (setting seqnum to NOTUSED), send it by calling tolayer3, and deliver received packet

to layer 5 by calling tolayer5. If the received packet is corrupted or out of order, discard the

packet but send an ACK.

o A_init( ) and B_init( ): called before any other A’s or B’s functions to do initialization. Be sure to

initialize the variables used by your functions such as base, nextseqnum, buffront bufrear,

msgnum, winfront, winrear, pktnum, expectedseqnum etc.

• SECTION III: network emulation code. THERE IS NO REASON THAT ANY STUDENT SHOULD HAVE TO

READ OR UNDERSTAND THE CODE BELOW. YOU SHOULD NOT TOUCH, OR REFERENCE (in your code)

ANY OF THE DATA STRUCTURES.

• SECTION IV: The functions provided in this section can be called by your functions. Reading the code

of these functions may help you understand how the network emulator works. However, this is

absolutely not necessary in order to complete the project. AND YOU SHOULD NOT MODIFY ANY OF

THE CODE IN THIS SECTION.

Important Notes • It is important for your program to follow exactly the output format shown in the above two

examples.

• The sequence number from the sender starts from 0. If the first packet received by the receiver

is corrupted or unexpected, the receiver sends an ACK packet with an ack number -1 because it

has not correctly received any packets.

• Receiver in GBN can’t send NACK packets, it is only allowed to send ACK packets.

• When the sender receives a packet from layer 5 while its sending window is full, it buffers it in

the buffer (defined by struct msg buffer[MAXBUFSIZE]; in the code), and sends it when the

window has a slot.

• You are NOT allowed to change any code in Sections 0, III, and IV of gbn.c.

• Violations will result in point reduction (see Grading Policy).

CSE422 Sec 002 – Computer Networking Fall 2018

7 Updated: 10/4/2018 9:40 AM

Grading 1. Late submission: within 24 hours (you will receive a penalty of 30% of your points), after 24

hours (you will receive no points) If you are going to be submitting late, you must request an

extension from the instructor.

2. Change of code in Sections 0, III, and IV of gbn.c: -5 points per change

3. You may define new global variables in Section II of gbn.c. However, you should keep the

number of new global variables to be fewer than three. 2 points per variable will be deducted

when the number of new variables is more than three.

4. The total points of this project are 100. Your code will be graded according to the following

criteria:

Compilation: Your code should be compilable on Adriatic. 50% of grade will be deducted if your

code fails to compile.

Protocol logic and programming style: Correct logic of GBN protocol behavior; 20 points will be

deduced if the program uses NACK packets. Proper and meaningful comments for variables and

statements.

Accuracy: Your program should generate the correct results AND follow the exact format of

output as specified in the examples.

Bonus Points The code that can improve the throughput of GBN significantly will earn extra 20 points. Your code

must be implemented in the functions to be completed, i.e., you can’t define new functions. To earn

the extra marks, you need to provide:

• A separate source file with name gbn2.c in addition to gbn.c.

• A document (in txt/word/pdf format) that describes in detail your design and implementation.

• Numerical results that show how much (in percentage) your program improves the throughput

of the basic GBN with different channel patterns and sender window sizes. The results should be

presented using charts/figures/tables.

Submission You will submit the following in an archive file name prj2_xxxx.zip where xxxx is your network login

name:

1. modified gbn.c

2. make file used to build your project code

3. other documents specified in the 'Bonus Points' section

Your zip file containing the above should be turned through the handin system.

Your code must be compilable on Adriatic.

Homework is Completed By:

Writer Writer Name Amount Client Comments & Rating
Instant Homework Helper

ONLINE

Instant Homework Helper

$36

She helped me in last minute in a very reasonable price. She is a lifesaver, I got A+ grade in my homework, I will surely hire her again for my next assignments, Thumbs Up!

Order & Get This Solution Within 3 Hours in $25/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 3 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 6 Hours in $20/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 6 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 12 Hours in $15/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 12 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

6 writers have sent their proposals to do this homework:

Smart Homework Helper
Supreme Essay Writer
Quick N Quality
Calculation Guru
Assignment Hut
Assignments Hut
Writer Writer Name Offer Chat
Smart Homework Helper

ONLINE

Smart Homework Helper

I find your project quite stimulating and related to my profession. I can surely contribute you with your project.

$36 Chat With Writer
Supreme Essay Writer

ONLINE

Supreme Essay Writer

I am an experienced researcher here with master education. After reading your posting, I feel, you need an expert research writer to complete your project.Thank You

$47 Chat With Writer
Quick N Quality

ONLINE

Quick N Quality

I am an elite class writer with more than 6 years of experience as an academic writer. I will provide you the 100 percent original and plagiarism-free content.

$28 Chat With Writer
Calculation Guru

ONLINE

Calculation Guru

I can assist you in plagiarism free writing as I have already done several related projects of writing. I have a master qualification with 5 years’ experience in; Essay Writing, Case Study Writing, Report Writing.

$27 Chat With Writer
Assignment Hut

ONLINE

Assignment Hut

Being a Ph.D. in the Business field, I have been doing academic writing for the past 7 years and have a good command over writing research papers, essay, dissertations and all kinds of academic writing and proofreading.

$16 Chat With Writer
Assignments Hut

ONLINE

Assignments Hut

I find your project quite stimulating and related to my profession. I can surely contribute you with your project.

$27 Chat With Writer

Let our expert academic writers to help you in achieving a+ grades in your homework, assignment, quiz or exam.

Similar Homework Questions

Words that describe jay gatsby - Fallon company uses flexible budgets to control its selling expenses - Little birdwood cabernet shiraz merlot 2016 - Ess services home depot - 12 years a slave reflection paper - Why does zinn claim that wilson made a flimsy argument - Her three days short story questions - Newcastle personality assessor test - Writing assignment - Credentialed community language test - Diz co is a us based mnc - Compare 19th Century Migration - West mercia police federation - ** WRITERVICTOR ** X2 DISCUSSION QUESTIONS (250 WORDS, 1 CURRENT SOURCE) APA - Example of a self critique for speech - Maersk betting on blockchain - 1776 goddess liberty coin value - Panadol 1-5 years dosage - Explain why a linear function may not be adequate for describing the supply and demand functions. - Bio-anth - Bio rad ih 1000 - Nursing diagnosis for community assessment - Database systems and knowledge base - Film form and culture 4th edition pdf - When was the poem she walks in beauty written - Pros and cons of piezoelectric sensors - Inverse square law radiation lab report - Naf strong or weak - Essay - City district government karachi - Neil armstrong is my uncle discussion questions - Answer the questions - Franchise Valuation - Mount alexander shire council ceo - Junot diaz how to date a browngirl analysis - Discussion 3c2 - How to describe location spread and shape - Nursing. - Discussion Post T6-Q1 Business Strategy - Guyan machinery a west virginia manufacturing corporation - Physical Assessment Reflection - Reflection - How to meet children's individual needs - MG375 Unit 3 Assignment - Basic laboratory techniques experiment 1 lab report - Galen university application form - Characteristics of public management - Musculoskeletal - Book review - Darrick wood infant school - Frida kahlo self portrait with thorn necklace and hummingbird essay - Www lafarge co ke - Cloud Computing and Digital Forensics - Need today - Juveniles And Adult Crimes - Physics 101 final exam - Nonverbal Communication TED Talk - Best report card comments - Dawn house school term dates - Cuckoo's Book Analysis - Goal setting for students template - Australia awards indonesia short term awards - Dan murphy vodka cruiser sugar free - Singapore airlines address for cover letter - Statement of work document - Abc us history project - 1 minute speaking topics - Cheyenne regional medical center human resources - Developing Your Design Solution - What is a repeat sign in music - Commemorative speech outline on a person - CJUS 420 DB FORUM 3 THREAD due 9/9/2020 - Blockchain literature review - Jessica valenti i cheated on my husband - Week 2 App Post/Anthony - Criminology the core edition 6 - Legal admission board qld - Morgan spurlock 30 days minimum wage summary - Accounting for Private Versus Public Companies I - What is the instrument to measure mass - The mystery of faith himes pdf - Crime fighter vs public servant - Exam number 700138 - DEVELOPING IDEAS - Pseg meter reader test - Is there a fee to enter yellowstone national park - Funk roberts circuit workout - Circular motion physics lab - Donkey i'm all alone song - Effective sensible heat factor - Ted bundy case study - Consulting proposal - Cybertext building blocks of accounting a financial perspective - Apex xt auto settings - Parkinson Disease Case Study - Bachelor of computer engineering unsw - St annes childrens centre - Blue haven spa manual - The helping process in human services - Advertising and public relations research jugenheimer pdf - Power point