https://serverfault.com/questions/368567/why-is-it-3-way-handshake-and-not-more
https://serverfault.com/questions/369056/tcp-whats-the-purpose-of-the-third-step-of-3-way-handshake
https://networkengineering.stackexchange.com/questions/24068/why-do-we-need-a-3-way-handshake-why-not-just-2-way
https://gateoverflow.in/123902/three-handshake-handshake-problem-which-solved-handshake
I read all over the place but still can't find concrete answer on what problem does tcp 3 way handshake solves.
It must be designed in a clever approach.
PS how do I use this technique while building software architecture?
The answer is in the nature of TCP where it wants to guarantee transmission. The three way handshake means that the recipient can get a message from the sender, the sender can get acknowledgement from the recipient, and the recipient can get final acknowledgement from the sender - it means the connection is stable enough for bidirectional transmission.
Compared to UDP, which is connectionless, TCP has much greater overhead. This is why voice and video protocols rely on UDP and some modern applications for HTML such as Google's QUIC also go with UDP. It will send faster and if parts are missing, then error correction on the client end can patch things over. But for secure data transmission where completeness is required and integrity must be assured, then heavier TCP-based protocols are needed.
Consider these jokes:
I have a UDP joke, and I don't care if anyone gets it. ;D
***
Hello, would you like to hear a TCP joke?
Yes, I'd like to hear a TCP joke.
OK, I'll tell you a TCP joke.
Okay, I will hear a TCP joke.
Are you ready to hear a TCP joke?
Yes, I am ready to hear a TCP joke.
Okay, I am about to send the TCP joke. It will last 50 seconds, has 634 characters, does not have an explicit setting, and ends with a punchline.
Okay, I am ready to get the TCP joke that will last 50 seconds, has 634 characters, does not have an explicit setting, and ends with a punchline.
I'm sorry, your connection timed out ... Hello, would you like to hear a TCP joke?