Three-way handshake

from Wikipedia, the free encyclopedia

The three-way handshake ( English Three-way handshake ) is a method for establishing lossless data transfers between two instances. Although predominantly used in computer networks, the three-way handshake is not limited to this.

The two armies problem

When transporting messages, the participating entities need some way of ensuring that the entity they are contacting has received the message. The sending entity therefore wants a confirmation response when the message has arrived. The problems that can arise here if the communication medium is not reliable are explained in more detail using the two armies problem :

Position of the armies. Army A is split into two parts, A1 and A2. Army B is in one part.

Imagine two armies A and B, where army A is stronger than army B. Army A is split into two parts A1 and A2, each of these parts cannot defeat Army B on its own. A1 and A2 must attack at the same time in order to win. It is therefore necessary to determine the exact time of the attack by messenger before the attack. A1 sends a message to A2 with the time of the attack. The only way from A1 to A2, however, is through the area of ​​B. A1 requires confirmation that the message has arrived at A2, since A1 must be sure that A2 was also informed of the time of the attack. The following two problems arise:

  • A1 sends a message to A2, but the messenger is already intercepted in B's warehouse. So A1 doesn't know if the original message was intercepted, or just A2's acknowledgment response.
  • A1 sends a message to A2, but the messenger is intercepted in B's warehouse when A2 receives confirmation. A2 cannot therefore be certain that the confirmation response has arrived at A1.

Both sub-armies can therefore never be sure that their message has arrived at the other army's, since the confirmation replies cannot be reliably transported either and A1 and A2 would also have to have the confirmation replies confirmed.

The three-way handshake


In communications engineering, this problem always occurs when there is an unreliable transmission channel between the communication partners.

The two armies problem is unsolvable. You would have to "confirm confirmation" infinitely many times to be sure that the recipient has received the message. Since this is unrealistic and would not lead to an end, one must deal with possible packet loss by taking suitable measures when operating a communication system .

The problem when establishing a connection is particularly critical, as the communication partners do not yet know about each other at the beginning, i.e. they have not yet taken any precautions for retransmission ( timeouts , etc.).

A three-step process for establishing a connection is therefore often chosen, the so-called three-way handshake. You can think of this as making an appointment by email. If Alice wants to meet Bob, the following messages are exchanged:

  1. Alice sends Bob an appointment proposal;
  2. Bob sends Alice a confirmation of the proposed date including his proposed date;
  3. Alice sends Bob a confirmation that she has received Bob's confirmation and appointment proposal.

The confirmations are necessary so that the parties know of the receipt of the message from the respective counterparty. There is always the risk that the last message will not be received and that only one party will appear for the meeting. However, after the second message there is an acceptably small risk that the third message will not arrive (after all, the first two messages have also arrived), so that the handshake is ended after the third message.

Areas of application


The best-known application of the three-way handshake is in computer networks and here again the protocol TCP , which is used there for connection-oriented communication. A detailed description of this form of the three-way handshake, which is used here to establish a connection, can be found in the article Transmission Control Protocol .

Asynchronous buses

The signals on asynchronous computer buses are not clocked, so that a clock cannot be used to control communication between the microprocessor and different connected components. Therefore, some variants of the handshake procedure are also used in this area. The basic principle remains largely unchanged.

An example of this bus communication is a simple control of bus access to the system bus . If a component wishes to have read or write access to the system bus, it sends a special signal ( bus request ) to the microprocessor. As soon as the processor does not need the bus, it grants the component access by means of a special response signal ( bus grant ). The component responds to this permission with a confirmation ( Bus Grant Acknowledge ) to indicate to the processor and all other components that it has taken control of the bus. As you can see, the names of the individual messages can differ with different handshake procedures.

Similar methods can also be used to control communication on different buses. The method can also be combined with clocking in some cases. A common case is the coordination of the address and data bus . The processor applies a special signal ( address strobe ) to the control bus to indicate that it has applied a valid address to the address bus. This address belongs to a component (it can be a memory or an input / output device, for example). This component can use a positive ACK edge to inform the processor that it has recognized itself as the addressee. The processor then withdraws its address strobe signal. The component can now, for example, write the requested data to the data bus or read it in from there. The component can report the completion of this process by means of a negative ACK edge. The type of communication is a bit more complex because of the three buses involved (control bus, address bus and data bus), but the basic principle of the three-way handshake can still be seen here.


  • Stephanie Knecht-Thurmann: I SA Server 2004 . The manual for installation and administration, Addison-Wesley Verlag, Munich 2006.
  • Daniel Martin Sülz: Internetworking in adult education. Norderstedt 2009, ISBN 978-3-8391-4336-0 .
  • Steve MacQuerry: Interconnecting Cisco Network Devices. Markt + Technik Verlag, Munich 2000, ISBN 3-8272-5799-9 .
  • Christoph Meinel, Harald Sack: Internetworking. Technical basics and applications. Springer-Verlag, Berlin / Heidelberg 2012, ISBN 978-3-540-92940-6 .
  • Peter Mandl, Andreas Bakomenko, Johannes Weiss: Basic course in data communication. TCP / IP-based communication, 2nd edition, Springer Fachmedien, Wiesbaden 2010, ISBN 978-3-8348-0810-3 .
  • Martin Eigner, Florian Gerhardt, Torsten Gilz, Fabrice Mogo Nem: Information technology for engineers. Springer Verlag, Berlin / Heidelberg 2012, ISBN 978-3-642-24892-4 .

Individual evidence

  1. Andrew S. Tanenbaum / David J. Wetherall, Computer Networks, 5th Edition, 2012, ISBN 978-3-86894-137-1 , Chapter 6.2.3., "Release of connections"

Web links

  • Botnets (accessed August 31, 2017)