Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Need an explanation of sliding window for networking

  1. May 11, 2016 #1
    So I have a school project that requires me to use a sliding window in order to transmit a file to a server, but I'm having trouble understanding how sliding window works.

    I don't really understand how rejects are done and how the program knows to send a new packet and then move onto the next window. Can someone explain it to me please? I've tried googling it several times but I just can't seem to grasp it entirely. Thanks for your help.
     
  2. jcsd
  3. May 11, 2016 #2
    Worst wikipedia article ever. Read this:
    http://searchnetworking.techtarget.com/definition/sliding-windows
    Basically it seems tcp has a built in buffer, so a reciever can read ahead of whatever application is reading it. Since tcp sends "confirmations" of transmissions recieved, it can get better performance by asking for more chunks of data at a time, or increasing the size of the "window.
     
    Last edited: May 11, 2016
  4. May 11, 2016 #3

    jedishrfu

    Staff: Mentor

    TCP will also use hash codes to verify that the data got sent correctly. As an example, if you sent the string hello world then a hash code of the string as well as its length would be sent. The receiver would rehash the data and if the new hash doesn't match the old it will request a retransmission of the block.
     
  5. May 12, 2016 #4

    Svein

    User Avatar
    Science Advisor

    There are several ways of sending data and confirming that the data has been received (not received correctly, that is another theme).
    1. Every transfer chops the data into smaller chunks, called "packets" or "frames".
    2. There is a finite probability that a packet is lost in transmission. If so, it needs to be retransmitted.
    3. The simplest way is to send one packet and require a receipt (an "acknowledge") for that packet before the next packet is sent. If no acknowledge is received inside a specific time limit, the packet is retransmitted.
    4. In order to ensure that the retransmitted packet is not confused with the next packet (the packet may have been received, but the acknowledge may have been lost), all packets are identified with a packet number.
    5. If few packets are lost, waiting for an acknowledge after every packet wastes time and bandwidth. You may then decide to send a number of packets before requiring an acknowledge. This is the basic "sliding window" principle.
    • The number of packets sent before an acknowledge is required is called the "window".
    • The window size must be negotiated between the sender and the receiver before starting the transfer
    • After transmitting the number of packets that the window size specifies, the sender stops and waits for an acknowledge.
    • The acknowledge from the receiver contains the packet number of the next expected packet (or the last received packet, it depends on the protocol)
    • If no acknowledge if forthcoming, the sender usually sends a control packet requesting an acknowledge.
    Different protocols use slightly different variations here. A special case is TCP, which dynamically adjusts the size of the window depending on whether packets are lost or not.

    Note: This is just a short summary of the subject!
     
  6. May 23, 2016 #5

    chiro

    User Avatar
    Science Advisor

    Hey serp777.

    What network protocol are you thinking of using and what network library are you thinking of using?
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Need an explanation of sliding window for networking
  1. OpenMPI on windows (Replies: 3)

  2. C# Window Resizing (Replies: 5)

Loading...