All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class reliability.SlidingWindowReceiver

java.lang.Object
   |
   +----reliability.SlidingWindowReceiver

public class SlidingWindowReceiver
extends Object
implements ReliableReceiver, PacketReceiver
This class implements a sliding-window reliability algorithm

See Also:
ReliableReceiver

Constructor Index

 o SlidingWindowReceiver(Network, Address)
Set up a receiver.

Method Index

 o PacketArrived(NetworkPacket)
Processing that happens when we receive a packet

For stop-and-wait: ack iff packet is old or can be stored, advance currentSequenceNum if packet is new and stored

 o Receive(int)
Receive a block of data from the connection.

Constructors

 o SlidingWindowReceiver
 public SlidingWindowReceiver(Network network,
                              Address address)
Set up a receiver.

Parameters:
network - the network over which to communicate
address - the address of this host

Methods

 o Receive
 public byte[] Receive(int numBytes)
Receive a block of data from the connection. Data blocks of any size may be received, and the operation will block until that much data is available.

Parameters:
size - the number of bytes requested
Returns:
the data received, up to the number of bytes requested
 o PacketArrived
 public void PacketArrived(NetworkPacket pk)
Processing that happens when we receive a packet

For stop-and-wait: ack iff packet is old or can be stored, advance currentSequenceNum if packet is new and stored


All Packages  Class Hierarchy  This Package  Previous  Next  Index