SWSender

stopAndWait. SWSender

A class that represents a stop-and-wait sender.

Constructor

new SWSender(options)

Creates a new SWSender instance.

Parameters:
Name Type Description
options Object

The constructor options.

Properties
Name Type Description
receiver SWReceiver

The stop-and-wait receiver.

timeout number

The time to wait for each acknowledgment from the receiver.

channel Channel

The channel through which to send the packets.

Source:

Extends

  • AbstractARQSender

Members

(readonly) currentSeqNum :number

The current sequence number to send and wait for acknowledgments.

Source:

(readonly) isWaitingAck :boolean

true if the node is waiting for an acknowledgment, false otherwise.

Source:

Methods

(protected) _canSend() → {boolean}

Tests whether the node can send the next packet or not.

Source:

(protected) _checkReceivedPkt(packet) → {boolean}

Tests whether a received packet is correct or not. A packet is correctly received if the node is waitiing for an acknowldgment, the packet is not corrupted, is an acknowlegment, and the acknowledged sequence is the expected one.

Parameters:
Name Type Description
packet Packet

The packet to test.

Source:

(protected) _onTimeout(seqNum)

Resends the packet corresponding to seqNum and resets the timeout.

Parameters:
Name Type Description
seqNum number

The sequence number for which the timeout passed.

Source:

(protected) _processExpectedPkt(packet)

Processes a correctly received packet.

Parameters:
Name Type Description
packet Packet

The packet to process.

Source:

(protected) _processSending()

Sends a packet for the current sequence number, and starts a timeout.

Source: