Timeline for Why do we need a 3-way handshake? Why not just 2-way?
Current License: CC BY-SA 4.0
23 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 15, 2018 at 18:08 | comment | added | Ron Maupin♦ | When one peer sends a SYN, it says, "I want to talk, and these are my capabilities." The ACK from the other side says, "OK. I can send that way." Then the other side sends a SYN that says, "I want to talk, and these are my capabilities," and the other side sends a SYN saying, "OK. I can send that way." That is peer-to-peer. When only one side send a SYN, then it is dictating the terms for one-way traffic, but TCP is two-way traffic. | |
| May 15, 2018 at 17:58 | comment | added | Ron Maupin♦ | In peer-to-peer, like TCP, each side must negotiate the connection. Your example only has only one side negotiating the connection. That is why TCP must have a three-way (really a compressed four-way) handshake. There must be a SYN from each side that is ACKed by the other side to negotiate the two-way connection. | |
| May 15, 2018 at 17:53 | comment | added | Sanzhar Yeleuov | @RonMaupin but my protocol is peer-to-peer, not client/server please read carefully. It is just names for example. You could change direction of arrows if you want. | |
| May 15, 2018 at 17:43 | comment | added | Ron Maupin♦ | "question is not about TCP, it is about why TCP was developed in that way _" That makes no sense. A question about how/why TCP was developed _is a question about TCP. Your hypothetical, client/server protocol has nothing to do with the TCP peer-to-peer model. In client/server, one side is in charge, but in peer-to-peer, each side is equal. | |
| May 15, 2018 at 17:37 | comment | added | Sanzhar Yeleuov | @RonMaupin question is not about TCP, it is about why TCP was developed in that way | |
| May 15, 2018 at 17:36 | comment | added | Ron Maupin♦ | "stop trying to apply TCP to my scenario." The question is specifically about TCP. Answering for another, hypothetical protocol is gratuitous. | |
| May 15, 2018 at 17:32 | comment | added | Sanzhar Yeleuov | @RonMaupin stop trying to apply TCP to my scenario. In my scenario there is a protocol that uses 2-way handshake to make a connection. Both sides can send SYN to request for connection, and both sides if got a SYN and agree to make connection, reply with ACK and think that connection is established. And after getting ACK also think that connection is established | |
| May 15, 2018 at 17:17 | comment | added | Ron Maupin♦ | I understand what you are trying to say, but you don't seem to understand what I am trying to say. I think part of it is that you are stuck on client/server, which TCP doesn't do. TCP is peer-to-peer, and there must be a negotiation for each peer. In client/server, one side can dictate, but TCP knows nothing about clients or servers, which is an application concept. Each TCP peer is equal, and each can both send and receive, so each has a two-way handshake that gets compressed to a three-way handshake. | |
| May 15, 2018 at 17:10 | comment | added | Sanzhar Yeleuov | @RonMaupin you are not even trying to understand what I meaning with my post. Be patient and re-read. In question there are asking why we do not use 2-way handshake (right under "Why not just this?" ). I gave a scenario in my answer (btw i modified it) when 2-way handshake may lead to a problem called half-connection. And to avoid such situations we use 3-way handshake | |
| May 15, 2018 at 17:02 | comment | added | Ron Maupin♦ | There is no two-way handshake. You cannot negotiate the parameters in a two-way handshake, and any traffic received until the three-way handshake is complete will result in a RST. "Server doesn't see resent SYN, so he thinks that client got his ACK and connection is established." No, it doesn't because it has a timer waiting for an ACK back from its SYN/ACK. It's not very complicated. | |
| May 15, 2018 at 16:57 | history | edited | Sanzhar Yeleuov | CC BY-SA 4.0 |
deleted 72 characters in body
|
| May 15, 2018 at 16:55 | comment | added | Sanzhar Yeleuov | @RonMaupin Please re-read my answer again, I mean that accepted answer doesn't answer the question totally. I wanted to show that 2-way handshake may lead to half-connection, what is not good for server. | |
| May 15, 2018 at 16:49 | comment | added | Ron Maupin♦ | It's all in the RFC. Until a connection is open, any traffic received will result in a RST. The three-way handshake negotiates the connection parameters, so the "server" cannot send anything back to the "client" but it's SYN/ACK until it receives an ACK from the "client". If the "server" SYN/ACK back to the "client" is lost, the "server" will try again. The RFC explains all this. | |
| May 15, 2018 at 16:43 | comment | added | Sanzhar Yeleuov | @RonMaupin I mean if scenario from my post remain same, only thing that changed, that ACK was lost. | |
| May 15, 2018 at 16:38 | comment | added | Ron Maupin♦ | If the ACK is lost, then the initiated connection in step 1 will time out. RFC 793 has a full explanation of all types of scenarios, including diagrams. | |
| May 15, 2018 at 16:34 | comment | added | Sanzhar Yeleuov | @RonMaupin Then let's assume situation when ACK packet was lost. | |
| May 15, 2018 at 14:42 | comment | added | Ron Maupin♦ | Actually, if a host (clients and servers are an application concept about which TCP knows nothing) receives an ACK or any traffic on a non-existent connection (step 3 in your scenario), it will send a RST, not ignore the received segment. | |
| May 15, 2018 at 10:24 | history | undeleted | Sanzhar Yeleuov | ||
| May 15, 2018 at 10:24 | history | edited | Sanzhar Yeleuov | CC BY-SA 4.0 |
added 301 characters in body
|
| May 15, 2018 at 10:12 | history | deleted | Sanzhar Yeleuov | via Vote | |
| May 15, 2018 at 9:48 | review | Late answers | |||
| S May 15, 2018 at 10:14 | |||||
| May 15, 2018 at 9:33 | review | First posts | |||
| S May 15, 2018 at 10:14 | |||||
| May 15, 2018 at 9:33 | history | answered | Sanzhar Yeleuov | CC BY-SA 4.0 |