cs436-A2-w14

Javaprovidedwiththeassignment public class packet

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 
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; private int seqnum; private int length; private String data; ……… } 
 // // // // 0: ACK, 1: Data, 2: EOT 0, 1 Length of the String variable ‘data’ String with Max Length 500 1
 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
 e...
View Full Document

This homework help was uploaded on 04/06/2014 for the course CS 436 taught by Professor Dr.reidholmes during the Winter '11 term at Waterloo.

Ask a homework question - tutors are online