# Sliding window and flow control
## Obiettivi di apprendimento

* understand the concept of windowsize and sliding window
* understand how flow control can prevent TCP connections to overload link layer protocols and slow networks

## Trascrizione

TCP – sliding window and flow control
Let’s imagine that sender wants transfer a data packet of 8kB (8192) to the recipient. According to the three-way handshake, he sends a SYN segment to establish a connection. He states his receiving buffer size in the TCP header as the window size. In our case – 4096. Additionally he sends his maximum segment size in the TCP header- 1460. The recipient acknowledges the SYN (his own SYN) and states buffer size with 4096 as well as his maximum segment size – 1024. Let’s assume that sender will always send data segments of 1024 bytes. This means that he will send (8192/1024=8) 8 segments. He acknowledges the SYN of the recipient of another ACK. The connection is now open with the buffer size of 4096 and the maximum segment size of 1024. That’s how we know (4096/1024=4) that the sender is allowed to sent 4 data packets before he has to receive an acknowledgment from the recipient. After receiving 4 packets the recipient buffer is completely full. So the window is closed. Data has not been retrieved from the buffer yet. That’s why the recipient will set the window size 0, meaning that he cannot receive any data yet. The recipient acknowledges the retrieval by sending an ACK with the sequence number + 4097. In this way he states that he successfully received 4096 bytes and that he now expect the next bytes to be the byte number 4097.
As soon as the recipient has processed some of the received data, he will open it’s window by sliding it. In our case 3 segments have been processed and ARK is send to the sender in which he acknowledges the received segments but also states his window size to be 3072. The sender will transmit the next 3 elements. The recipient will acknowledges this with an ACK and a window size 0 since no further data has been processed from the buffer yet. After processing an additional 2 segments he will open his window again by sliding and transmitting another ACK to the sender acknowledging that byte 7169 is expected ext and his window size is 2048. The sender transits the last segment and also sets a FIN flag in a TCP header to state that he wants to close the connection. . The recipient acknowledges the last packet with an ACK that is open at window size 4096. Finally he also sends the FIN flag. The last FIN segment will be acknowledged so that the connection is closed. --Jane Kruch (discuss • contribs) 19:11, 3 November 2013 (UTC)

## Ulteriori letture

* Transmission Control Protocol
* Flow control
* Sliding Window Protocol
* Maximum Segment Size
* Congestion Window

## Discussioni

* Ethernet
** Communication over a shared Medium
** Ethernet header
** Minimum package length vs maximum cable length
** Collision detection
** Summary, further reading, homework
* Internet Protocol
** Motivation for IP
** Classful IPv4 networks
** IP forwarding algorithm
** IP header
** Summary, further reading, homework
* Transmission Control Protocol
** End to end principle and connection oriented communication
** Three way handshake
** Port numbers
** Sliding window and flow control
** Summary, further reading, homework
* Domain Name System
** Tree structure
** Terminology
** Zones
** Review some facts about DNS
** Delegating DNS queries
** DNS address resolution
** Summary, further reading, homework
* Internet vs World Wide Web
** Summary of the internet architecture
** Motivation and requirements for the World Wide Web
** Design principles of the web
** Uniform Resource Identifier
** Summary, further reading, homework
* Hypertext Transfer Protocol
** Making HTTP requests
** A simple web client
** A simple web server
** HTTP header
** Content negotiation
** Summary, further reading, homework
* Web content
** Problem setting for web content formats
** Working with XML
** HTML for web document structures
** Layout elements in HTML
** Motivating separation of content and layout
** Cascading Style Sheets
** Media content
** Metadata
** Summary, further reading, homework
* Dynamic Web Content
** Basics of server side web programming
** Forms and HTTP post request
** Handling a post request in a Java Servlet
** Client side JavaScript
** Ajax and the XMLHttpRequest class
** Summary, further reading, homework