11 KiB
| title | chunk | source | category | tags | date_saved | instance |
|---|---|---|---|---|---|---|
| TCP handshake - Glossary | MDN | 1/3 | https://developer.mozilla.org/en-US/docs/Glossary/TCP_handshake | reference | web, html, css, javascript, documentation | 2026-05-05T05:46:40.383270+00:00 | kb-cron |
MDN HTML HTML: Markup language
HTML reference
HTML guides
Markup languages
CSS reference
CSS guides
Layout cookbook
JavaScriptJS JavaScript: Scripting language
JS reference
JS guides
Web APIs Web APIs: Programming interfaces
Web API reference
Web API guides
- Using the Web animation API
- Using the Fetch API
- Working with the History API
- Using the Web speech API
- Using web workers
Technologies
Topics
Learn Learn web development
Frontend developer course
- Getting started modules
- Core modules
- MDN Curriculum
- Check out the video course from Scrimba, our partner
Learn HTML
Learn CSS
Learn JavaScript
Tools Discover our tools
About Get to know MDN better
TCP handshake
TCP (Transmission Control Protocol) uses a three-way handshake (aka TCP-handshake, three message handshake, and/or SYN-SYN-ACK) to set up a TCP/IP connection over an IP based network. Similarly, a four-way handshake is used to terminate the connection. The three messages transmitted by TCP to negotiate and start a TCP session are nicknamed SYN, SYN-ACK , and ACK for SYN chronize, SYN chronize-ACK nowledgement, and ACK nowledge respectively. The three message mechanism is designed so that two computers that want to pass information back and forth to each other can negotiate the parameters of the connection before transmitting data such as HTTP browser requests.
- The initiator, generally the browser, sends a TCP SYNchronize packet to the other host, generally the server.
- The server receives the SYN and sends back a SYNchronize-ACKnowledgement.
- The initiator receives the server's SYN-ACK and sends an ACKnowledge. The server receives ACK and the TCP socket connection is established.
This handshake step happens after a DNS lookup and before the TLS handshake, when creating a secure connection. The connection can be terminated independently by each side of the connection via a four-way handshake, where a pair of FIN (finish) and ACK messages are sent and received independently by each side.
- The initiator sends a FIN packet to the other host.
- The other host sends an ACK packet back to the initiator.
- Now, the connection is half-closed, and the other host can still send data. (For example, the server can finish off sending data to the client when the client has closed its connection to the server.)
- The other host sends a FIN packet to the initiator.
- The initiator sends an ACK packet back to the other host.
In this article
See also
- Transport Layer Security (TLS) protocol
- Related glossary terms:
- Transport Layer Security on Wikipedia