2020 International Conference on Computational Science and Computational Intelligence (CSCI)

Comparison between Automatic Repeat Request (ARQ) Protocols and solving the Buffer Problem

Mohammed Rajhi Hatim Madkhali Department of Computer Science and Networking Department of Information Technology Jazan University Jazan University Jazan, Saudi Arabia Jazan, Saudi Arabia Email: [email protected] Email: [email protected]

Abstract— Today is the era of fast and dynamic internet and It provides an environment for easy developing and sharing of communication technologies which make communication projects. The simulation engine presents a context for various convenient compared to the past. Communication technology, through different channels, such as mobile phones and simulation scenarios [2]. It also provides numerous computers, has become pervasive. In almost every means of implemented models of how computer networks work. NS-3 telecommunication, retransmission protocols have played a provides an opportunity to study system behavior while also significant role in the protocol stack layers. The primary aim of providing a detailed investigation of how networks work in a this study is to compare Automatic Repeat Request (ARQ) greatly controlled, reproductive environment [2]. protocols and solve the Buffer problem. The first section compares ARQ protocols (Go-Back-N, selective repeat, stop and II. TRANSMISSION CONTROL PROTOCOLS wait ARQ), using TCP and UDP. The study compares these Transmission Control Protocol (TCP) is one of the main protocols' efficiency and changes the behaviors of stop and wait protocols to selective repeat. The second section includes solving protocols in the in ISO/OSI (International the buffer problems. The paper contains the theoretical part as Standards Organization / Open System Interconnection) well. model. Many application protocols use TCP. User Datagram Protocol (UDP) is recognized as another Keyword: Selective Repeat, Stop and wait, ARQ, TCP, Buffer essential protocol on the transport layer with some I. INTRODUCTION various characteristics and services, frequently compared to TCP [8]. Simulation environments are helpful tools in different informative fields. Simulation software allows testing of A. Connection-oriented of TCP protocol real time situations without one having to actually buy a TCP is a connection-oriented protocol. It establishes a product or service. This has resulted in the software pragmatic path between the source and the destination of being widely appreciated by students and professionals. data transfer and close the connection [8]. During data With that angle, this project is using an open-source transfer, there is a three-way handshake that creates a complicated network simulation termed as NS-3. The connection in the first part that opens connection This main objective of this project is to design two different sends a segment with a random initial sequence number, simulation scenarios. Data transfer requires that and SYN Flag is set. The other part responds with a reliability is an essential factor, specifically in the case segment that sets SYN and ACK flags bits [8]. of packer networks. Automatic-Repeat Request (ARQ) has various mechanisms. The most important mechanisms in this respect are; Stop-and-Wait and Selective-Repeat. Various protocols are using these mechanisms to ensure controlled flow, controlled errors, and congested controls. Go-Back-N is also a significant mechanism, but this study does not target it [1]. These mechanisms play an important role in transporting layers of ISO/OSI (International Standards Organization / Open System Interconnection) model for wire networks. The most reliable and the base protocol of the transport layer is TCP (Transmission Control Protocol). In the same way, ARQ mechanisms play an important role in establishing a link layer in wireless networks. A. Network Simulator (NS-3) The NS-3 simulator is an open-source discrete-event network Fig. 1: The connection using three-way handshake [9] simulator primarily used for research or education.

978-1-7281-7624-6/20/$31.00 ©2020 IEEE 195 DOI 10.1109/CSCI51800.2020.00040 After establishing connection, data transfer continues. out-of-order segments, it is combined with the behavior Sequence and acknowledgment numbers are changed in of Selective-Repeat ARQ. the same pathway of establishing connection. The data's size increases the numbers [8]. III. LITERATURE REVIEW Various researchers and scholars have previously

B. TCP send and receive windows investigated mechanisms for ARQ. Ramadan, Z., & TCP utilizes two windows for each direction of data Siahaan, A. P. U. (2016) suggested that transmission can transfer. The first one is a send window and the second face damage in sending data leading to corrupt data [4]. one is a receive window. Therefore, Corrupted data cannot fulfill the needs of data 1) A Send Window transmission. Stop-and-wait methods of Automatic- The receiver changes the window size as flow control Repeat- Request can help resolve these errors. Data using congestion control mechanism. The Send window transmission requires a sending and a receiving then opens, closes, or shrinks [8]. There is a usable computer [2]. Stop-and-Wait- methods of Automatic- window portion in the send window and a part where Repeat- Request ensures packet drops do not cause loss bytes are awaiting acknowledgement. The window size of data, and that data is received accurately. The stop- is thousands of bytes [8]. and-Wait method can automatically fix corrupted data. In another study, Bada, A. B. (2017) stated that Automatic Repeat Request (ARQ) protocols play an important role in offering a wide range of paths for reliable transmission of data [3]. Similarly, Automatic Repeat Request (ARQ) protocols are widely used in error control systems with a primary aim to ensure reliability and validity of transferred data. Some of the most significant types of protocols in this regard include Stop and wait (SW), Go-Back-N (GBN), and Selective Repeat (SR). The study highlights various advantages Fig 2. The send window size with change [9] and limitations of these different types of protocols. This study also highlights the most reliable transmission 2) A Receive Window system named Hybrid ARQ (HARQ) in detail [6]. The receiver window size defines how multiple bytes can be received from the sender before overflow; this IV. AUTOMATIC REPEAT REQUEST (ARQ) process is called flow control [8]. TCP works by default The paper uses three basic ARQ methods; Stop-and- cumulative acknowledgment by advertising the Wait ARQ method, Go back N method, and Selective- following expected byte to receive. Selective Repeat ARQ method. Often, the data link or transport acknowledgments can be set in TCP header options [8]. layer of the ISO/OSI model uses these ARQ methods [4]. It is important to note that a reliable transport layer protocol such as TCP is needed for successful incorporation of ARQ and wireless data link protocols [4]. A. Stop-and-Wait ARQ Stop-and-wait method is the most significant method whereby the receiver and sender have sliding window (size 1). The sender in this method is allowed to send only one segment. The sender cannot send this segment Fig 3. The receive window size with change [9] to another sender unless they receive acknowledgement C. The similarity to Automatic repeat request for already sent segments. This method also allows (ARQ) receiver to detect corrupted segment using the checksum Most TCP implementations are implemented without field [4] and the sender has an opportunity to retransmit Selective acknowledgment and only cumulative the segment after time-out. acknowledgments sent. In this case, it mimics the Go- 1) Numberin system Back-N ARQ method though with temporary storing of This method allows sending of only one segment unless an acknowledgement to send another segment has been

196 received. The sequence number field has only binary 푡0 퐸[푡푡표푡푎푙] = [7] digits; 0 and 1. Though, the sequence number changes 1 − 푃푓 with change in the segment [5]. Therefore, the transmission rate effectiveness becomes: 2) Efficiency 푛푓 − 푛0 Assuming the link rate is R, frame size in bits will be 푛 푅푒푓푓 = 푓 퐸[푡푡표푡푎푙] and acknowledgment size in bits be 푛푎. Assuming there (푛푓 − 푛0) is a processing delay at the both of 푡 . Then the time = (1 − 푃푓) (1 푝푟표푐 푡0 to send a frame, to receive and acknowledgment 0 − 푃푓)푅푒푓푓 [7] becomes: Efficiency of the transmission is: 푛푓 푛푎 푡 = 2푡 + 2푡 + + [7] 휂 = (1 − 푃 )휂 [7] 0 푝푟표푝 푝푟표푐 푅 푅 푓 0 푛 When 푓 is the transmission delay of the frame, the The presence of errors diminishes the effective 푅 transmission rate and efficiency by a factor of (1 − 푃 ) transmission rate effectiveness in the absence of the 푓 where 푃 is the probability of the errored frame. errors becomes: 푓 0 푛푓 − 푛0 B. Selective repeat ARQ 푅푒푓푓 = [7] 푡0 The second method under consideration is selective- Where 푛0 is number of overhead bits in the frame. repeat method. Go-Bank-N has substantial limitations Transmission efficiency of the stop and wait scheme is that reduce efficiency of this method. Nevertheless, then: selective-repeat method solves this problem making it 푛 − 푛 푓 0 easier for simulators to deal with such challenges. This 푡0 휂0 = method primarily suggests that the information tracked 푅 is for only one segment and it must not be used in 푛0 1 − previous sections [7]. 푛푓 = [7] 1) Windows and timers 푛 2(푡 + 2푡 )푅 1 + 0 + 푝푟표푝 푝푟표푐 It is important to ensure that the sender window is of the 푛 푛 푓 푓 same size as the receiver window. It is also important to The numerator illustrates loss in efficiency due to header 푛 ensure that all segments deliver application layer with a bits while the denominator 푎 illustrates the loss in 푛푓 primary aim to eliminate errors [8]. efficiency due to the time demanded for the 2) Efficiency The purpose of selective repeat is to retransmit the acknowledgment message. The term 2(푡푝푟표푝 + 2푡푝푟표푐)푅 is the delay bandwidth product. In stop and wait, the packets that are in error. A review is shown in both the delay-band-width product can be observed as measure of absence and the presence of errors. The maximum a lost possibility in terms of transmitted bits [6]. In the plausible given headers are needed in the absence of the errors. error presence, assuming 푃푓 is the probability that a 푛 휂푆퐸퐿 = 1 − 0 [7] received frame has the errors, the transmission 0 푛 efficiency of the stop and wait becomes: 푓 푛 1 − 0 푛푓 In presence of the errors: 휂 = (1 − 푃푓) [7] 푆퐸퐿 푛0 푛 2(푡푝푟표푝 + 2푡푝푟표푐)푅 휂 = (1 − 푃 ) (1 − ) [7] 1 + 0 + 푓 푛 푛푓 푛푓 푓 Letting 푃 be the number of transmissions expected to 푓 As long as selective repeat is only the failed frame deliver a packet successfully, ( 푖 − 1) unsuccessful and 푖 retransmitted, 푊푠 multiplying factor is not needed. the successful transmission. It becomes: ∞ 푖−1 푃[푛푡 = 푖] = (1 − 푃푓)푃푓 푓표푟 푖 = 1,2, … 퐸[푡푆퐸퐿 ] = 푡 {1 + ∑(푖 − 1)(1 − 푃 )푃푖−1} [7] ∞ 푡표푡푎푙 푓 푓 푓 푖=1 퐸[푡푡표푡푎푙] = 푡0 + ∑(푖 − 1)푡표푢푡 푃[푛푡 = 푖] [7] 푆퐸퐿 푃푓 푖=1 퐸[푡푡표푡푎푙] = 푡푓 {1 + } [8] ∞ 1 − 푃푓 푖−1 Therefore, the transmission rate will be: = 푡0 + 푡표푢푡 ∑(푖 − 1) (1 − 푃푓)푃푓 [7] 푖=1 In the case of time out 푡표푢푡 = 푡0, then it becomes:

197 푆퐸퐿 푛푓 − 푛0 푛0 instances and compares different methods. The reason is 푅푒푓푓 = 푆퐸퐿 = (1 − 푃푓) (1 − ) 푅 [7] that most of the contemporary implementation of TCP is 퐸[푡푡표푡푎푙] 푛푓 And the transmission efficiency will be: implemented without Selective acknowledgment, and only cumulative acknowledgments are sent. The first 푆퐸퐿 푛0 휂 = (1 − 푃푓) (1 − ) = 1 − 푃푓 [7] part also compares TCP (with other ARQ method) to 푛푓 UDP transmission [2]. Error communication is vital in C. Go-Back-N ARQ this regard making the simulation consist of crucial Go-Back-N allows one to send more than one segment behavior. before receiving acknowledgments. Just like in Stop and It is important to look for certain requirements to create Wait protocol [8], the receiver is still only buffered one a scenario in NS-3. They include creating different segment. Send end segments are further stored in the nodes, ensuring communication, and generating a static sender part continuously where acknowledgments are routing plan. There are various methods of transferring a received. message, and these methods are dependent upon signals. 1) Window and timers The most important thing to understand is that voice Because only one segment can be sent until transfer has different signs compared to data transfer. acknowledgment arrives, the sequence number field is For example, telephone networks use circuit switching only one bit (two plausible numbers 0 and 1). If the while most of the contemporary data networks use segment is acknowledged, the sequence number is packet switching. However, it is significant to modified. If the packet is lost, the segment's response is understand that these methods can have different data to send again with the number of the same sequence. methods of receiving, storing, and forwarding. 2) Efficiency A. Implementing scenario 푛 If 푊 푓 ≥ 푅푇푇 or equivalently, it will be like the 푠 푅 Below is the foundation’s implementation of the following: scenario. In this section, the foundation of the method is laid out which includes creating nodes, creating channels 푛푓 (푛푓 − 푛0) among nods, setting up IP Address, Installing TCP/IP 푊 ≥ 2푡 + + 푡 [7] 푠 푅 푝푟표푝 푅 푝푟표푐 stack, generating TCP flow and creating receiver of data. It helps to understand ARQ basic methods. Pointing the Data sent continuously by the sender. When the first topology, simulation begins. Running it in the first Acknowledgment arrives, the sender starts sending over simulation, shows that more segments are sent without the top of the window. 푊푠 is the maximum number of acknowledging the first one. The window is more the outstanding frames at any instant? If 푛푎 and 푡푝푟표푐, significant or more extensive than one segment. are ignored, it becomes; Distinctly, it's a cumulative acknowledgment, meaning 2푅푡푝푟표푝 it's Go-Back-N. 푊푠 + 1 [7] 푛푔 2푅푡푝푟표푝 Is the delay bandwidth product seen in the relationship between the window sizes? in the absence of errors, the efficiency of Go-Back-N becomes: Fig 4. Go-Back-N 푛 휂퐺퐵푁 = 1 − 0 [7] 0 푛 So, the question arises of how to mimic or change it as 푓 Selective Repeat. An error in the medium could be In presence of errors, it becomes: generated and utilized as class RateErrorModel for

producing byte and recently packet loss. Similarly, an 푛푓 − 푛0 푛 (1 − 0) 퐺퐵푁 푛 increase of the data rate of TCP applications from the 퐺퐵푁 퐸[푡푡표푡푎푙] 푓 휂 = = (1 − 푃푓) [7] default setting is made. The behavior matches the 푅 1 + (푊푠 − 1)푃푓 Selective-Repeat-method. Therefore, stimulating V. AUTOMATIC REPEAT REQUEST ARQ 1ST SCENARIO selective repeated.

In this scenario, we compare the ARQ method or algorithm using TCP, UDP, change Stop and wait to mimic a selective repeat. In the first part of the report, the ARQ method used in TCP protocol uses significant Fig 5. Selective-Repeat

198 We deleted the generation of the loss and set-up of data C. Comparative ARQ with TCP and UDP rate for better control and more apparent output with UDP isn't practical because any useful protocol from the more reluctant communication. And we try to set 1000 higher layer to deal with retransmission could not be B, which should be excellent for one of our packets of found. We had to create another node the same as the size 512 B (with header) and ACK of size 54 B. It is earlier ones and produce the same point-to-point then that the receiver reports more than 512 B window connection between the new Nodes. We had to set IP size; the sender sends only one packet each time and addresses on the new interfaces and set-up routing for waits for acknowledgement. This makes it a behavior of enabling communication, so the first node and last node Stop-and-Wait method. are the differing.

Fig 6. Stop-and-wait

B. Stop and wait to selective repeat We have recognized that ARQ is a mechanism, not a protocol. We can shift some settings from Selective- Repeat to Stop-and-Wait. If the receive and send window would be reduced for only one segment size, there would be no possibility for the sender to send another segment until it is acknowledged. But this is Fig 10. Size of transmitted data (TCP-UDP) possible in NS-3; where we diminish the receive- window, and by that, send window becomes the same size as performed by mechanisms in NS-3. We found a possibility in class TcpSocket, where receiving RcvBufSize buffer can be modified. Sending buffer changes was not useful because the sender window was, after creating a connection, the lowest from congestion or receiver window (usually in real networks). So, when the receive window was reduced, the sent window remained the same.

Fig 11. Size of transmitted data more node (TCP-UDP)

Fig 7. Stop-and-wait (Selective Repeat)

Fig 8. Stop-and-wait (Selective Repeat) Fig 9. Time of transmission (TCP-UDP)

199 VI. AUTOMATIC REPEAT REQUEST 2ND SCENARIO D. Another Recommendation Selective Repeat protocol is the most effective protocol Since the receiver needs to release packets to a higher in terms of throughput, and as such, it is extensively layer in order, the receiver needs to also buffer some implemented in various appliances. Nevertheless, this packets. For this, we have reduced the packet size and it efficiency is worthy, as it is one of the most complex reads ‘reduce buffer size.' In fact, when the window size retransmission protocols to perform and analyze. In this is small, performance remains the same and with a large design, we use a method to solve the buffer problem. window, Selective Repeat becomes even much better.

A. Motivation The selective-repeat protocol aims to enable the receiver to both acquire and buffer the frames following a damage or in case of a loss. This is made easier because in such incidences, the sender buffers all packets until they are acknowledged. In cases where the Stop and Wait protocol keeps the sender waiting for the acknowledgements, the solution to this is that the sender has to transmit multiple packets while waiting to acknowledge a given packet. B. The Requirements The initial step is for the sender and receiver to buffer a number (W) of packets, and then the sender labels the packets consecutively. The receiver then buffers packets received without error, acknowledges them, and delivers Fig.14. Size of transmitted Selective Repeat (TCP) the packets to the network layer accurately. The Sender buffers then copies the transmitted packet till it receives Packets are buffered when they are not processed or the corresponding acknowledgment and retransmits a transmitted at the rate at which they arrive. The packet when it’s working time expires with no buffering size depends on the arrival traffic. The reason acknowledgment. Acknowledgment is of the sequence behind it is that over-buffering raises the end-to-end number of the packets. delay in the presence of congestion. This is remarkably C. Buffer Overflow Solution the case with TCP. If a single TCP flows in the absence of other restrictions, it fills the buffer of a bottleneck link Assuming that the maximum of W = 4 in the buffer. regardless how big the buffer is. In such cases, extensive

buffers can’t satisfy the low-latency specifications of real-time applications. The buffers’ size changes nothing for these applications, unlike in open-loop systems where the larger buffers do not significantly influence outcomes in the most important throughput under the TCP’s closed-loop rate control mechanism. In an open- loop system, the transmission rate is independent of the

Fig 12. The packets should be allowed [10] buffer size; hence the throughput is only a function of the buffer’s drop rate. Below the closed-loop mechanism Therefore, send will transmit a new packet if the of TCP, the average throughput over a round-trip time difference in the smallest and the largest sequence in the RTT is W/RTT. We require RTT×C buffers with just buffer is smaller than the W. one TCP flow therefore we need to understand the dynamics of TCP. The window-size governs the dynamics of a TCP flow (the quantity of outstanding unacknowledged packets).

VII. CONCLUSION This project has afforded to create simulations in the NS-3 environment, which involves an extensive scale of Fig 13. The packets should be allowed [10] opportunities to create many new modules.

200 To conclude, this study has also highlighted data X. REFERENCES transmission using the Automatic Repeat Request [1] H. S. H. &. S. P. Aliwi, “A comparative study of VoIP protocols.,” (ARQ) protocol. This study’s first section has International Journal of Computer Science and Information Security, 11(4), p. 97., 2013. highlighted the Go-Back-N, Stop-and-wait method, and [2] M. Y. R. H. R. K. M. &. S. M. Naderi, “Error control for multimedia selective-repeat method. It has also compared the communications in wireless sensor networks: A comparative performance efficiency on those protocols. The scenarios have analysis.,” Ad Hoc Networks, 10(6), pp. 1028-1042., 2012. illustrated to reduce the buffer in a selective repeat [3] RFC 793: TRANSMISSION CONTROL PROTOCOL[online]. protocol. Theoretical sections have included everything September1981 [cit. 2016-12-05]. Available from needed for a better understanding of each scenario. URL:. Despite the scenarios being created focusing on [4] S. H. C. H. L. &. L. J. H. Wu, “Effectiveness and relay efficiency of opportunistic multipoint relaying on cooperative ARQ.,” IEEE Transactions on individual work, each section has been illustrated in Vehicular Technology, 66(6), pp. 4781-4796., 2016. detail. [5]Z. W. Q. &. W. J. Zhang, “ARQ protocols in cognitive decode-and-forward relay networks: Opportunities gain.,” Radioengineering, 24(1), p. 297., 2015. VIII. FUTURE WORK The study has aimed to encourage future researchers to [6] Y. G. J. &. S. A. Hu, “QoS-constrained energy efficiency of cooperative ARQ in multiple DF relay systems.,” IEEE Transactions on Vehicular investigate the working mechanism of Hybrid ARQ Technology, 65(2), pp. 848-859., 2015. (HARQ) as it is the most significant and emerging [7] A. Leon Garcia and I. Widjaja, Communication Networks. McGraw Hill, Automatic-Repeat-Request (ARQ) protocol. The 2000. reliability of this Automatic Repeat Request (ARQ) [8] FOROUZAN, Behrouz A.TCP/IP protocol suite. 4th ed. Boston: McGraw- protocol is more than the other protocols such as Stop HillHigher Education,c2010. ISBN 00-733-7604-3. and wait (SW), Go-Back-N (GBN), and Selective [9] Bureš, F. (2017). NEW SIMULATION SCENARIOS IN NS3 Repeat (SR). Additionally, the data transmission speed ENVIRONMENT. Retrieved October 28, 2020, from of Hybrid ARQ (HARQ) is better compared to the other https://www.vutbr.cz/www_base/zav_prace_soubor_verejne.php?file_id=157583 protocols. [10] Garcia- Luna-Aceves, J.,. (n.d.). CSE250A: Computer Networks, Part 1 Slide. Retrieved Fall, 2020. IX. ACKNOWLEDGMENT We would like to thank our supervisor Professor J. J. Garcia-Luna-Aceve, for helping in this project. His skills and expertise were vital, we are also appreciative of his technical piece of advice and consultation. Secondly, it is an honor for us to thank TA Minmei Wang, Dylan Cirimelli-Low and all of our friends in the computer communication lab as well.

201