Sale!

Assignment  2   Computer  Networks  (CS  456) Answered

$20.00 $14.00

Original Work ?

Download Details:

  • Name: a02.zip
  • Type: zip
  • Size: 161.58 KB

Category: You will Instantly receive a download link upon Payment||Click Original Work Button for Custom work

Description

5/5 - (1 vote)

Assignment  Objective   The  goal  of  this  assignment  is  to  implement  the  Go-­‐Back-­‐N  protocol,  which  could  be  used  to  transfer  a   text  file  from  one  host  to  another  across  an  unreliable  network.  The  protocol  should  be  able  to  handle   network  errors  such  as  packet  loss  and  duplicate  packets.  For  simplicity,  your  protocol  is  unidirectional,   i.e.,  data  will  flow  in  one  direction  (from  the  sender  to  the  receiver)  and  the  acknowledgements  (ACKs)   in  the  opposite  direction.  To  implement  this  protocol,  you  will  write  two  programs:  a  sender  and  a   receiver,  with  the  specifications  given  below.  You  will  test  your  implementation  using  an  emulated   network  link  (which  will  be  provided  to  you)  as  shown  in  the  diagram  below:

When  the  sender  needs  to  send  packets  to  the  receiver,  it  sends  them  to  the  network  emulator  instead   of  sending  them  directly  to  the  receiver.  The  network  emulator  then  forwards  the  received  packets  to   the  receiver.  However,  it  may  randomly  discard  and/or  delay  received  packets.  The  same  scenario   happens  when  the  receiver  sends  ACKs  to  the  sender.     Note:  The  assignment  description  (data  structure  and  program  names)  assumes  an  implementation  in   Java.     2    Packet  format   All  packets  exchanged  between  the  sender  and  the  receiver  should  have  the  following  structure  (consult   packet.java  provided  with  the  assignment):     public class packet { … … … private int type; // 0: ACK, 1: Data, 2: EOT private int seqnum; // Modulo 32 private int length; // Length of the String variable ‘data’ private String data; // String with Max Length 500 … … … }
2

The  type  field  indicates  the  type  of  the  packet.  It  is  set  to  0  if  it  is  an  ACK,  1  if  it  is  a  data  packet,  2  if  it  is   an  end-­‐of-­‐transmission  (EOT)  packet  (see  the  definition  and  use  of  an  end-­‐of-­‐transmission  packet   below).  For  data  packets,  seqnum  is  the  modulo  32  sequence  number  of  the  packet.  The  sequence   number  of  the  first  packet  should  be  zero.  For  ACK  packets,  seqnum  is  the  sequence  number  of  the   packet  being  acknowledged.  The  length  field  specifies  the  number  of  characters  carried  in  the  data   field.  It  should  be  in  the  range  of  0  to  500.  For  ACK  packets,  length  should  be  set  to  zero.     3    Sender  Program  (sender)   You  should  implement  a  sender  program,  named  sender,  on  a  UNIX  system.  Its  command  line  input   includes  the  following:   3

3    Receiver  Program  (receiver)   You  should  implement  the  receiver  program,  named  as  receiver,  on  a  UNIX  system.  Its  command  line   input  includes  the  following:   4

6    Hints     • Use  the  packet  class  given  in  packet.java  containing  necessary  declarations,  definitions,  and   helper  methods.   • All  the  packets  must  be  sent  and  received  as  byte  arrays  instead  of  as  Java  packet  objects.  Since   the  network  emulator  is  written  in  C/C++,  it  cannot  read  Java  objects.  Necessary  code  to  convert  the   packet  class  into  byte  array  and  vice  versa  is  provided  in  the  packet.java  file.   • You  must  run  the  programs  in  the  CS  Undergrad  Environment  in  order  to  allow  nEmulator  to   work.   • Experiment  with  network  delay  values  and  sender  time-­‐out  to  understand  the  performance  of  the   protocol.   • Run  nEmulator,  receiver,  and  sender  on  three  different  machines  in  this  order  to  obtain   meaningful  results.     6.1    Example  Execution   1.    On  the  host  host1:  nEmulator 9991 host2 9994 9993 host3 9992 1 0.2 0   2.    On  the  host  host2:  java receiver host1 9993 9994