SRSender

selectiveRepeat. SRSender

A class that implements the sender of selective-repeat.

Constructor

new SRSender(options)

Creates a new SRSender instance.

Parameters:
Name Type Description
options Object

The constructor options.

Properties
Name Type Description
receiver SRReceiver

The selective-repeat receiver.

timeout number

The time to wait for an acknowledgment from the receiver.

channel Channel

The channel through which to send the packets.

windowSize number

The size of the sliding window.

Source:

Extends

  • AbstractWindowedSender

Methods

(protected) _checkReceivedPkt(packet) → {boolean}

Tests whether a received packet is correct or not. A packet is correct if it's an acknowledgment, it's not corrupted and, the acknowledged sequence was sent and has not been confirmed already, or the acknowledgment is cumulative and the acknowledged sequence is in the current window of sent packets.

Parameters:
Name Type Description
packet Packet

The packet to test.

Source:

(protected) _onTimeout(seqNum)

Resends the packet corresponding to seqNum and resets its timeout.

Parameters:
Name Type Description
seqNum number

The sequence number for which the timeout passed.

Source:

(protected) _processExpectedPkt(packet)

Processes a correctly received packet, confirming the acknowledged sequence and all previous unacknowledged sent sequences if the packet is a cumulative ack. Moves the window if the base sequence of the window is confirmed.

Parameters:
Name Type Description
packet Packet

The packet to process.

Source:

(protected) _processSending()

Sends a packet and sets its timeout.

Source: