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

From Wikiversity
Jump to: navigation, search

Three way handshake

Wikiversity-Mooc-Icon-Edit.svg
Wikiversity-Mooc-Icon-Ask.svg
Wikiversity-Mooc-Icon-Learning-goals.svg

Learning goals

  1. understand the concept of a logical connection (virtual communication channel) between two computers on the internet
  2. understand the importance of acknowledging received messages
  3. be able to understand the process of establishing a tcp / connection
Wikiversity-Mooc-Icon-Edit.svg
Wikiversity-Mooc-Icon-Ask.svg
Wikiversity-Mooc-Icon-Video.svg

Video

Wikiversity-Mooc-Icon-Edit.svg
Wikiversity-Mooc-Icon-Ask.svg
Wikiversity-Mooc-Icon-Script.svg

Script

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 (discusscontribs) 17:10, 3 November 2013 (UTC)

Wikiversity-Mooc-Icon-Edit.svg
Wikiversity-Mooc-Icon-Ask.svg
Wikiversity-Mooc-Icon-Quiz.svg

Quiz

1

Which fields are set in which phase of the handshake messages

SYN ACK
1st Message
2nd Message
3rd Message

2

What is the difference between a TCP client and a TCP server?

only if the client asks for data the server can respond with data
only clients can start the process of a three way handshake
only servers can start the process of a three way handshake
once the connection is established both the client and server can send data at any time.
there is not difference between client and server

3

Once the three way handshake was used to establish a connection. What will happen if a packet from host A is not acknowledged?

the connection will be closed by A
the packet will be send over and over again by A
A initiates a trace root so that it can decide if there is still a physical connection with the recipient.
A will send the packet again with an increased priority


Wikiversity-Mooc-Icon-Edit.svg
Wikiversity-Mooc-Icon-Ask.svg
Wikiversity-Mooc-Icon-Further-readings.svg

Further reading

Wikiversity-Mooc-Icon-Discussion.svg

Discussion