# Three way handshake
## Obiettivi di apprendimento

* understand the concept of a logical connection (virtual communication channel) between two computers on the internet
* understand the importance of acknowledging received messages
* be able to understand the process of establishing a tcp / connection

## Trascrizione

TCP three-way handshake
One of the most important features of TCP is that we can make sure that packages really arrive at the other side when talking to host on the Internet. The basic ides of achieving this goal is to acknowledge every send package. In order to do so we need to establish connection between the computers. This doesn’t mean physically interconnect the computers but rather to create virtual communication channel which can be used for reliable transmission of IP packages.
So when we wish to establish TCP-connection between 2 hosts on the WEB we need to make sure that both hosts can create this virtual cannel of communication and thereby establish the connection. This is achieved with 3-way handshake. As you want to establish a connection with another computer you could just send him IP package stating your interest to talk to each other. You do this by sending IP package in which you place a TCP package. Inside the TCP header you specify your wish to synchronize so you set the SYN-bit. Additionally you generate a random 32-bit number between 0 and 2^32 that is called sequence number and send this over to the other host. In the case the recipient successfully receiver the package it can answer back an Acknowledgment message (ACK). This message contains your sequence number +1. If you never receive this message (which can happen because your package was not delivered) you will receive an error message that the connection could not be established. In the case you received the data your connection is still not ready. A connection should be symmetric in a sense that both hosts could initialize to send data at any point of time.
Your communication partner not only sends an acknowledgment message to you but also generates his own sequence number and sends it together with SYN-flag set. So as you receive a response you know that your connection is established but you also have to acknowledge your partner request to establish the connection. So you take his sequence number and add 1 and put it as an acknowledgment number to the TCP package. You increase your own sequence number by 1 and put it together with the data that you want to transfer into your next TCP package. This is the 3rd message to be delivered (or at least send).
Now whenever one of the communication participants send data packages the sequence number is increased. This will be used later to assemble packages to the file and the numbers are acknowledged by the other side. If packages are not acknowledged, the host will send package again and again. In this way TCP creates a reliable way of communication.
--Jane Kruch (discuss • contribs) 17:10, 3 November 2013 (UTC)

## Quiz

Web Science/Part1: Foundations of the web/Transmission Control Protocol/Three way handshake/quiz

## Ulteriori letture

* Connection establishment

## 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