## 3 Dual-Stack Single-Radio Communication Architecture (DSSRCA)
### UAV-to-Sink Communication
For every acknowledgment received, the sender moves the window one position to the right and sends the next message. If the receiver receives a message outside the range of the window, the message is discarded. However, if the message is in the range, but out of order, it is stored. For each message, the sender starts a timeout as previously described. When transmission losses occur, the proposed algorithm does not reduce the window size as is done by the traditional TCP congestion control algorithms. This is justified since the message loss is related to transmission errors and not to network congestion. Reducing the window size decreases the data delivery rate, and therefore the window size should be maintained or even increased. This technique is discussed in different studies, such as [31], in an effort to adapt TCP to wireless networks or other high error rate mediums. The multiple segment losses in the window can cause a degradation effect in the data rate. Traditional TCP implementations use cumulative acknowledgment scheme, in which the receiver sends an acknowledgment meaning that the receiver has received all data preceding the acknowledged sequence number. This mechanism forces the transmitter to wait for the timeout to find out that the message has been lost, which causes a flow decrease. The proposed TCP SACK (Selective Acknowledgment) [32] increases TCP performance in networks with high loss rate. The SACK aims to recover multiple lost segments within one RTT. To achieve this, the receiver provides enough information about the segments lost in its sliding window. With this information, the sender knows exactly which segments were lost and re-transmits them before the timeout expires. For implementing the sliding window algorithm with SACK, the sender maintains a set of sequence numbers corresponding to frames it is permitted to send, which are represented by two variables: S\({}_{L}\) (sender lower limit), _i.e._, the number of the oldest message sent but not acknowledged yet; and S\({}_{U}\) (sender upper limit), _i.e._, the number of the next message to send. Similarly, the receiver also maintains a receiving window corresponding to the set of messages it is permitted to accept, which are also represented by two variables: R\({}_{L}\) (receiver lower limit), _i.e._, the lowest numbered message that the receiver is willing to accept; and R\({}_{U}\) (receiver upper limit), _i.e._, one more than the highest numberedmessage the receiver is willing to accept. The implemented sliding window algorithm with SACK is presented in Algorithm 1. ```
1:Transmit all messages in the sender's window (S\({}_{L}\) to S\({}_{U}\)-1);
2:ifMessage arrives in the window and in correct sequence (R\({}_{L}\))then
3: Receiver acknowledges the message
4: Receiver copy R\({}_{L}\) to the application and advances its window
5:elseifMessage arrives in the window but is out of sequence (sequence \(>\) R\({}_{L}\) and \(<\)= R\({}_{U}\))then
6: Receiver acknowledges the message for the highest message correctly received
7: Attach a SACK list with the message(s) number(s) missing
8:endif
9:
10:ifSender receives an ACK for a message within its windowthen
11: Mark this message as correctly sent and received
12: If message number is S\({}_{L}\) then increment S\({}_{L}\) and S\({}_{U}\) and transmit S\({}_{U}\)-1
13:elseifSender receives an ACK with a SACK listthen
14: Re-transmit the correspondent messages contained in the SACK list and restart the timeout
15:endif
16:
17:ifTimeoutOccurthen
18: Re-transmit the corresponding message
19:endif
```  
**Algorithm 1** Sliding Window Algorithm with SACK