{"id":2815,"date":"2021-07-05T15:22:14","date_gmt":"2021-07-05T09:52:14","guid":{"rendered":"https:\/\/binaryterms.com\/?p=2815"},"modified":"2021-07-05T16:42:18","modified_gmt":"2021-07-05T11:12:18","slug":"selective-repeat-protocol","status":"publish","type":"post","link":"https:\/\/binaryterms.com\/selective-repeat-protocol.html","title":{"rendered":"Selective Repeat Protocol"},"content":{"rendered":"<p><strong>Selective repeat protocol<\/strong> is a sliding window protocol that uses the concept of pipelining where multiple packets can be sent while the sender is waiting for the acknowledgement for the first sent packet. The selective repeat protocol manages error and flows control between the sender and receiver.<\/p>\n<p>In this section, we will discuss the need for selective repeat ARQ (Automatic Repeat Request) and how it overcomes the shortcomings of the go-back-n protocol. We will also discuss the working of selective repeat with the help of an example.<\/p>\n<h3>Why Selective Repeat ARQ?<\/h3>\n<p>The go-back-n protocol that we have studied in our previous content is efficient if the error rate and loss of packets is less. If the connection is poor, there will be frequent loss of packets and the sender would have to retransmit all the outstanding packets. This wastes the bandwidth of the channel.<\/p>\n<p>In go-back-n, the size of the receiver window is 1 so it buffers only one packet in order that it has to acknowledge next and if this expected packet is lost or corrupted all the received out of order packets are discarded. And the sender has to retransmit all the outstanding packets though some of these may have arrived at the receiver safely but out of order.<\/p>\n<p>This retransmission of packets increases the traffic on the network creating a cumulative increase in congestion. The alternative approach for this is selective repeat protocol. In the section ahead we will discuss the working of this selective repeat protocol.<\/p>\n<h2>Working of Selective Repeat Protocol<\/h2>\n<p>Like go-back-n, selective repeat protocol is also a sliding window protocol. Unlike the go-back-n protocol, the selective repeat protocol resends only a selective packet that is either lost or corrupted. Let us first discuss the windows in selective repeat.<\/p>\n<p><strong>Window<\/strong><\/p>\n<p>In selective repeat, both sender and receiver have a sliding window. On the sender side, the window covers the sequence of packets that are either sent or can be sent. At the receiver, the sliding window covers the sequence number of the packets that are either received or are expected to be received. In selective repeat, the size of the sender and receiver window is the same. Let us study the sender window and receiver window in brief.<\/p>\n<p><strong>1. Sender Window<\/strong><\/p>\n<p>The sender window in selective repeat is much smaller as compared to the go-back-n protocol. The size of the sender window here is 2<sup>m-1<\/sup>. Here m is the number of bits used by the packet header to express the sequence number of the corresponding packet.<\/p>\n<p>The sender window covers the packets that are sent but not yet acknowledged, one that is acknowledged out of order and the one that can be sent once the data for the corresponding are received by the sender&#8217;s application layer.<\/p>\n<p><strong>2. Receiver Window<\/strong><\/p>\n<p>The maximum size of the receiver window is 2<sup>m-1<\/sup> which is the same as the sender window. The receiver window covers the sequence number of the packets that are received out of order and are waiting for the packets that were sent earlier but are not yet received.<\/p>\n<p>The receiver transport layer does not deliver packets out of order to the application layer. It waits until a set of consecutive packets are received so that they can be delivered to the application layer.<\/p>\n<p>In selective repeat, at the sender side, a timer is attached to each sent packet and if the acknowledgement is not received before the timer expire the corresponding packet is resent.<\/p>\n<p>Let understand selective repeat protocol with the help of an example. Consider that the header of a packet has allotted 3 bits to resemble the sequence number of the corresponding packet so m=3 here. Now as m is 3 the packets are sequenced using modulo 2<sup>m<\/sup>. So the sequence number of packets lie from 0, 1, 2, 3, \u2026, 7.<\/p>\n<p>The size of the receiver and sender window will be 2<sup>m-1<\/sup> i.e. 2<sup>3-1<\/sup> = 4. So the size of the receiver and sender window is 4.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2818\" src=\"https:\/\/binaryterms.com\/wp-content\/uploads\/2021\/07\/selective-repeat-protocol.jpg\" alt=\"selective repeat protocol\" width=\"600\" height=\"298\" srcset=\"https:\/\/binaryterms.com\/wp-content\/uploads\/2021\/07\/selective-repeat-protocol.jpg 600w, https:\/\/binaryterms.com\/wp-content\/uploads\/2021\/07\/selective-repeat-protocol-300x149.jpg 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p><strong>Operation at Sender Side<\/strong><\/p>\n<p>As you can see in the figure above the sender window covers the sequence number of the packets from 0 to 7 as the window size is 8. The sender has sent packets 0, 1, 2, and 3 and is waiting to receive the data of packets 4, 5, 6, and 7 for its application layer.<\/p>\n<p>Before the application layer provides data for packets 4 and 5, the sender receives an acknowledgement for frame 0 and the sender window slides by one slot. After receiving data for packets 4 and 5 the sender sends packets 4 and 5.<\/p>\n<p>Later the sender receives out of order acknowledgement for packets 2 and 3. The sender window does not slide as it has not yet received acknowledgement for packet 1. Meanwhile, the timer for packet 1 get expired and the sender has to resend packet 1.<\/p>\n<p><strong>Operation at Receiver Side<\/strong><\/p>\n<p>The size of the receiver window is 8 so the receiver window covers the sequence number from 0 to 7. If first receives packet 0 and immediately send an acknowledgement for it. Later it receives out of order packets 2 and 3 and sends an acknowledgement for these received packets. Late it again receives an out of order packet 5 and 1.<\/p>\n<p>The receiver stores the packets in the receiver window until there is a set of consecutive packets to be delivered to the application layer. In selective repeat, there should be a complex logic to reinsert the retransmitted packet in proper order. However, the sender must also have complex logic to identify and resend the packet out of order.<\/p>\n<p>In this way, the selective repeat avoids traffic on the network by retransmitting the corrupted the lost packet only. And this is possible as it allows the sending and receiving packets out of order.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Selective repeat protocol is a sliding window protocol that uses the concept of pipelining where multiple packets can be sent while the sender is waiting for the acknowledgement for the first sent packet. The selective repeat protocol manages error and flows control between the sender and receiver. In this section, we will discuss the need [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[5],"tags":[],"class_list":{"0":"post-2815","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-computer-networks","7":"entry"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>What is Selective Repeat Protocol? Introduction &amp; Working - Binary Terms<\/title>\n<meta name=\"description\" content=\"Selective repeat protocol is a sliding window protocol, and it resends only the lost or corrupted packet which reduces traffic on the network.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/binaryterms.com\/selective-repeat-protocol.html\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What is Selective Repeat Protocol? Introduction &amp; Working - Binary Terms\" \/>\n<meta property=\"og:description\" content=\"Selective repeat protocol is a sliding window protocol, and it resends only the lost or corrupted packet which reduces traffic on the network.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/binaryterms.com\/selective-repeat-protocol.html\" \/>\n<meta property=\"og:site_name\" content=\"Binary Terms\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-05T09:52:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-07-05T11:12:18+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/binaryterms.com\/wp-content\/uploads\/2021\/07\/selective-repeat-protocol.jpg\" \/>\n<meta name=\"author\" content=\"Neha T\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Neha T\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/binaryterms.com\/selective-repeat-protocol.html#article\",\"isPartOf\":{\"@id\":\"https:\/\/binaryterms.com\/selective-repeat-protocol.html\"},\"author\":{\"name\":\"Neha T\",\"@id\":\"https:\/\/binaryterms.com\/#\/schema\/person\/e495f1d57f5c0a4c521cc3dba95661fe\"},\"headline\":\"Selective Repeat Protocol\",\"datePublished\":\"2021-07-05T09:52:14+00:00\",\"dateModified\":\"2021-07-05T11:12:18+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/binaryterms.com\/selective-repeat-protocol.html\"},\"wordCount\":929,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/binaryterms.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/binaryterms.com\/selective-repeat-protocol.html#primaryimage\"},\"thumbnailUrl\":\"https:\/\/binaryterms.com\/wp-content\/uploads\/2021\/07\/selective-repeat-protocol.jpg\",\"articleSection\":[\"Computer Networks\"],\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/binaryterms.com\/selective-repeat-protocol.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/binaryterms.com\/selective-repeat-protocol.html\",\"url\":\"https:\/\/binaryterms.com\/selective-repeat-protocol.html\",\"name\":\"What is Selective Repeat Protocol? Introduction & Working - Binary Terms\",\"isPartOf\":{\"@id\":\"https:\/\/binaryterms.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/binaryterms.com\/selective-repeat-protocol.html#primaryimage\"},\"image\":{\"@id\":\"https:\/\/binaryterms.com\/selective-repeat-protocol.html#primaryimage\"},\"thumbnailUrl\":\"https:\/\/binaryterms.com\/wp-content\/uploads\/2021\/07\/selective-repeat-protocol.jpg\",\"datePublished\":\"2021-07-05T09:52:14+00:00\",\"dateModified\":\"2021-07-05T11:12:18+00:00\",\"description\":\"Selective repeat protocol is a sliding window protocol, and it resends only the lost or corrupted packet which reduces traffic on the network.\",\"breadcrumb\":{\"@id\":\"https:\/\/binaryterms.com\/selective-repeat-protocol.html#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/binaryterms.com\/selective-repeat-protocol.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/binaryterms.com\/selective-repeat-protocol.html#primaryimage\",\"url\":\"https:\/\/binaryterms.com\/wp-content\/uploads\/2021\/07\/selective-repeat-protocol.jpg\",\"contentUrl\":\"https:\/\/binaryterms.com\/wp-content\/uploads\/2021\/07\/selective-repeat-protocol.jpg\",\"width\":600,\"height\":298,\"caption\":\"selective repeat protocol\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/binaryterms.com\/selective-repeat-protocol.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/binaryterms.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Selective Repeat Protocol\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/binaryterms.com\/#website\",\"url\":\"https:\/\/binaryterms.com\/\",\"name\":\"Binary Terms\",\"description\":\"The Computer Science &amp; IT Guide\",\"publisher\":{\"@id\":\"https:\/\/binaryterms.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/binaryterms.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/binaryterms.com\/#organization\",\"name\":\"Binary Terms\",\"url\":\"https:\/\/binaryterms.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/binaryterms.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/05\/binary-terms-logo1.png\",\"contentUrl\":\"https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/05\/binary-terms-logo1.png\",\"width\":400,\"height\":63,\"caption\":\"Binary Terms\"},\"image\":{\"@id\":\"https:\/\/binaryterms.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/binaryterms.com\/#\/schema\/person\/e495f1d57f5c0a4c521cc3dba95661fe\",\"name\":\"Neha T\",\"url\":\"https:\/\/binaryterms.com\/author\/author\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What is Selective Repeat Protocol? Introduction & Working - Binary Terms","description":"Selective repeat protocol is a sliding window protocol, and it resends only the lost or corrupted packet which reduces traffic on the network.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/binaryterms.com\/selective-repeat-protocol.html","og_locale":"en_GB","og_type":"article","og_title":"What is Selective Repeat Protocol? Introduction & Working - Binary Terms","og_description":"Selective repeat protocol is a sliding window protocol, and it resends only the lost or corrupted packet which reduces traffic on the network.","og_url":"https:\/\/binaryterms.com\/selective-repeat-protocol.html","og_site_name":"Binary Terms","article_published_time":"2021-07-05T09:52:14+00:00","article_modified_time":"2021-07-05T11:12:18+00:00","og_image":[{"url":"https:\/\/binaryterms.com\/wp-content\/uploads\/2021\/07\/selective-repeat-protocol.jpg","type":"","width":"","height":""}],"author":"Neha T","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Neha T","Estimated reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/binaryterms.com\/selective-repeat-protocol.html#article","isPartOf":{"@id":"https:\/\/binaryterms.com\/selective-repeat-protocol.html"},"author":{"name":"Neha T","@id":"https:\/\/binaryterms.com\/#\/schema\/person\/e495f1d57f5c0a4c521cc3dba95661fe"},"headline":"Selective Repeat Protocol","datePublished":"2021-07-05T09:52:14+00:00","dateModified":"2021-07-05T11:12:18+00:00","mainEntityOfPage":{"@id":"https:\/\/binaryterms.com\/selective-repeat-protocol.html"},"wordCount":929,"commentCount":0,"publisher":{"@id":"https:\/\/binaryterms.com\/#organization"},"image":{"@id":"https:\/\/binaryterms.com\/selective-repeat-protocol.html#primaryimage"},"thumbnailUrl":"https:\/\/binaryterms.com\/wp-content\/uploads\/2021\/07\/selective-repeat-protocol.jpg","articleSection":["Computer Networks"],"inLanguage":"en-GB","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/binaryterms.com\/selective-repeat-protocol.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/binaryterms.com\/selective-repeat-protocol.html","url":"https:\/\/binaryterms.com\/selective-repeat-protocol.html","name":"What is Selective Repeat Protocol? Introduction & Working - Binary Terms","isPartOf":{"@id":"https:\/\/binaryterms.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/binaryterms.com\/selective-repeat-protocol.html#primaryimage"},"image":{"@id":"https:\/\/binaryterms.com\/selective-repeat-protocol.html#primaryimage"},"thumbnailUrl":"https:\/\/binaryterms.com\/wp-content\/uploads\/2021\/07\/selective-repeat-protocol.jpg","datePublished":"2021-07-05T09:52:14+00:00","dateModified":"2021-07-05T11:12:18+00:00","description":"Selective repeat protocol is a sliding window protocol, and it resends only the lost or corrupted packet which reduces traffic on the network.","breadcrumb":{"@id":"https:\/\/binaryterms.com\/selective-repeat-protocol.html#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/binaryterms.com\/selective-repeat-protocol.html"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/binaryterms.com\/selective-repeat-protocol.html#primaryimage","url":"https:\/\/binaryterms.com\/wp-content\/uploads\/2021\/07\/selective-repeat-protocol.jpg","contentUrl":"https:\/\/binaryterms.com\/wp-content\/uploads\/2021\/07\/selective-repeat-protocol.jpg","width":600,"height":298,"caption":"selective repeat protocol"},{"@type":"BreadcrumbList","@id":"https:\/\/binaryterms.com\/selective-repeat-protocol.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/binaryterms.com\/"},{"@type":"ListItem","position":2,"name":"Selective Repeat Protocol"}]},{"@type":"WebSite","@id":"https:\/\/binaryterms.com\/#website","url":"https:\/\/binaryterms.com\/","name":"Binary Terms","description":"The Computer Science &amp; IT Guide","publisher":{"@id":"https:\/\/binaryterms.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/binaryterms.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Organization","@id":"https:\/\/binaryterms.com\/#organization","name":"Binary Terms","url":"https:\/\/binaryterms.com\/","logo":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/binaryterms.com\/#\/schema\/logo\/image\/","url":"https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/05\/binary-terms-logo1.png","contentUrl":"https:\/\/binaryterms.com\/wp-content\/uploads\/2020\/05\/binary-terms-logo1.png","width":400,"height":63,"caption":"Binary Terms"},"image":{"@id":"https:\/\/binaryterms.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/binaryterms.com\/#\/schema\/person\/e495f1d57f5c0a4c521cc3dba95661fe","name":"Neha T","url":"https:\/\/binaryterms.com\/author\/author"}]}},"_links":{"self":[{"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/posts\/2815","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/comments?post=2815"}],"version-history":[{"count":8,"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/posts\/2815\/revisions"}],"predecessor-version":[{"id":2824,"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/posts\/2815\/revisions\/2824"}],"wp:attachment":[{"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/media?parent=2815"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/categories?post=2815"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/binaryterms.com\/wp-json\/wp\/v2\/tags?post=2815"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}