Assignment  2   Computer  Networks  (CS  456)  solution

$24.99

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

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: