All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class reliability.SAWReceiver

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

public class SAWReceiver
extends Object
implements ReliableReceiver, PacketReceiver
This class implements a stop-and-wait reliability algorithm. Connection setup is ignored. This will cause problems with connection patterns involving multiple senders.

See Also:
ReliableReceiver

Constructor Index

 o SAWReceiver(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 SAWReceiver
 public SAWReceiver(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