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
-
SAWReceiver(Network, Address)
- Set up a receiver.
-
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
-
Receive(int)
- Receive a block of data from the connection.
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
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
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