Docsity

Simple Transport Protocol Assignment for CMSC 417 Computer Networks - Prof. Samrat Bhattac, Assignments of Computer Systems Networking and Telecommunications

Toggle sidebar
bg1
CMSC 417 Computer Networks Spring 2009
Programming Assignment 5 — Simple Transport Protocol
Assigned: Mar. 28 Due: Apr. 8, 23:59:59.
1 Introduction
Youwill designasimple transportprotocolthatprovides reliable datagramservice. Yourprotocol
will be responsible for ensuring data is delivered in order, without duplicates or errors. Since the
local area networks in the university are far too reliable, we will provide a header file (emulation.h)
and a source file (emulation.c) for emulating an unreliable network. To used them, you have to
includetheheader file andcompile withthesource file. Thereis amacrodefined in emulation.h
to replace all call of sendto with emulate_sendto whichcanbeconfigured todrop,damage,
duplicate, or delay packets on demand. If the packet is not dropped, then it is sent to (using UDP)
the destination node as if sendto is invoked. Note that the emulate_sendto may corrupt a packet
and then send it, may send multiple copies of the same packet, or may delay for an amount of
timeandthen sendit.While debugging,Youcanselect thebehaviorofthefunction,anduse it to
test partsofyourcode. However,yourselectionwill beignored in grading,andthefunctionwill
randomly drop,damage, duplicate, ordelaypackets.
For the assignment, you will transfer a named file reliably from between two nodes (a sender
andareceiver).YoudoNOThavetoimplementconnectionopen/close etc. Youmayassumethat
the receiver is run first and will wait indefinitely, and the sender can just send a named file to the
receiver.
2 Emulation Setup
Both of your sender and receiver program have to include the header file emulation.h anduse only
sendto() function to send all packets. Including emulation.h will replace all instances of sendto()
with emulate sendto(), which is implemented in emulation.c. You may configure the emulated
network conditions by calling the following function:
void emulate_config(char drop, char damage, char duplicate,
char delay, int frequency);
•drop/damage/duplicate/delay flags: If you do not want emulate sendto() to drop, damage,
duplicate, or delay any packet, set the corresponding flags to 0; otherwise, set them to a
nonzerovalue. When thedelayflagis on,packetsmaybedeferred for200milliseconds–1
secondatrandom.
•frequency: Indicate how often your packets are affected by emulate sendto(). The content
of this field is used as the denominator of the treatment probability. If frequency is set to 0,
no packets will be harmed.
•Examples:
1
pf3

Partial preview of the text

Download Simple Transport Protocol Assignment for CMSC 417 Computer Networks - Prof. Samrat Bhattac and more Assignments Computer Systems Networking and Telecommunications in PDF only on Docsity!

CMSC 417 Computer Networks Spring 2009

Programming Assignment 5 — Simple Transport Protocol

Assigned: Mar. 28 Due: Apr. 8, 23:59:59.

1 Introduction

You will design a simple transport protocol that provides reliable datagram service. Your protocol will be responsible for ensuring data is delivered in order, without duplicates or errors. Since the local area networks in the university are far too reliable, we will provide a header file (emulation.h) and a source file (emulation.c) for emulating an unreliable network. To used them, you have to include the header file and compile with the source file. There is a macro defined in emulation.h to replace all call of sendto with emulate_sendto which can be configured to drop, damage, duplicate, or delay packets on demand. If the packet is not dropped, then it is sent to (using UDP) the destination node as if sendto is invoked. Note that the emulate_sendto may corrupt a packet and then send it, may send multiple copies of the same packet, or may delay for an amount of time and then send it. While debugging, You can select the behavior of the function, and use it to test parts of your code. However, your selection will be ignored in grading, and the function will randomly drop, damage, duplicate, or delay packets. For the assignment, you will transfer a named file reliably from between two nodes (a sender and a receiver). You do NOT have to implement connection open/close etc. You may assume that the receiver is run first and will wait indefinitely, and the sender can just send a named file to the receiver.

2 Emulation Setup

Both of your sender and receiver program have to include the header file emulation.h and use only sendto() function to send all packets. Including emulation.h will replace all instances of sendto() with emulate sendto(), which is implemented in emulation.c. You may configure the emulated network conditions by calling the following function:

void emulate_config(char drop, char damage, char duplicate, char delay, int frequency);

  • drop/damage/duplicate/delay flags: If you do not want emulate sendto() to drop, damage, duplicate, or delay any packet, set the corresponding flags to 0; otherwise, set them to a nonzero value. When the delay flag is on, packets may be deferred for 200 milliseconds – 1 second at random.
  • frequency: Indicate how often your packets are affected by emulate sendto(). The content of this field is used as the denominator of the treatment probability. If frequency is set to 0, no packets will be harmed.
  • Examples:
  • Suppose frequency is set to 10 and the drop flag is on. Then each of your packets may be lost with probability 101.
  • Suppose all flags are on, and frequency is set to 4. Then there is a one quarter chance for each of your packets to be lost, corrupted, duplicated, or delayed.
  • Suppose the damage flag is on and frequency is set to 1. Then each of your packets will certainly be corrupted.
  • Suppose frequency is set to 0. The flags won’t matter and your packet will not be affected. (Use for testing).
  • If this function is never called, all flags are on and the frequency is set to 10 by default.

You may modify emulation.c and emulation.h for testing, but make sure your submitted program works with the given emulation code. The emulation code you submit will be ignored.

3 Packet Format

You have to design your own packet format and use UDP as a carrier to transmit packets. Your packet might include fields for packet type, acknowledgement number, advertised window, data, etc. This part of the assignment is entirely up to you. Your code MUST:

  • Transfer the file name reliably.
  • Transfer the file contents reliably.
  • The receiver must write the contents it receives onto stable storage (disk) with the appropriate file name.
  • Your sender and receiver must gracefully exit.
  • Your code must be able to transfer a file with any number of the drop, damage, duplicate, and delay flags set as long as the frequency is not monotonously set to 1.

You may implement any reliability algorithm you choose. However, a more sophisticated algo- rithm will be given higher credit. For example, some desired properties include (but are not limited to):

  • Fast: Require little time to transfer a file.
  • Low overhead: Require low data volume to be exchanged over the network, including data bytes, headers, retransmissions, acknowledgements, etc.

4 Executables

The command line syntax and output for the sender executable is as follows:

sendfile -r recv_host:recv_port -f name_of_file_to_be_transmitted

  • When a sender sends a packet (including retransmission), it should print the following: [send data] start (length) where start is the beginning offset of the file sent in the packet, and length is the amount of the file sent in that packet.