Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Transmission Control Protocol
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Connection termination===<!--[[FIN (TCP)]] redirects here--> [[File:TCP CLOSE.svg|right|thumbnail|260px|Connection termination]] [[File:TCP close() - sequence diagram.svg|thumb|Detailed TCP close() sequence diagram]] The connection termination phase uses a four-way handshake, with each side of the connection terminating independently. When an endpoint wishes to stop its half of the connection, it transmits a FIN packet, which the other end acknowledges with an ACK. Therefore, a typical tear-down requires a pair of FIN and ACK segments from each TCP endpoint. After the side that sent the first FIN has responded with the final ACK, it waits for a timeout before finally closing the connection, during which time the local port is unavailable for new connections; this state lets the TCP client resend the final acknowledgment to the server in case the ACK is lost in transit. The time duration is implementation-dependent, but some common values are 30 seconds, 1 minute, and 2 minutes. After the timeout, the client enters the CLOSED state and the local port becomes available for new connections.<ref>{{Cite book |last=Kurose |first=James F. |url=https://www.worldcat.org/oclc/936004518 |title=Computer networking : a top-down approach |date=2017 |others=Keith W. Ross |isbn=978-0-13-359414-0 |edition=7th |location=Harlow, England |pages=286 |oclc=936004518}}</ref> It is also possible to terminate the connection by a 3-way handshake, when host A sends a FIN and host B replies with a FIN & ACK (combining two steps into one) and host A replies with an ACK.<ref>{{cite book|last= Tanenbaum|first= Andrew S.|author-link= Andrew S. Tanenbaum|title= Computer Networks|edition= Fourth|date= 2003-03-17|publisher= Prentice Hall|isbn= 978-0-13-066102-9|url= https://archive.org/details/computernetworks00tane_2}}</ref> Some operating systems, such as [[Linux]]<ref>{{Cite web |title=linux/net/ipv4/tcp_minisocks.c at master Β· torvalds/linux |url=https://github.com/torvalds/linux/blob/master/net/ipv4/tcp_minisocks.c |access-date=2025-04-24 |website=GitHub |language=en}}</ref> implement a half-duplex close sequence. If the host actively closes a connection, while still having unread incoming data available, the host sends the signal RST (losing any received data) instead of FIN. This assures that a TCP application is aware there was a data loss.{{sfn|RFC 1122|loc=4.2.2.13. Closing a Connection}} A connection can be in a [[TCP half-open|half-open]] state, in which case one side has terminated the connection, but the other has not. The side that has terminated can no longer send any data into the connection, but the other side can. The terminating side should continue reading the data until the other side terminates as well.<ref>{{Cite web |date=2020-03-02 |title=TCP (Transmission Control Protocol) β The transmission protocol explained |url=https://www.ionos.com/digitalguide/server/know-how/introduction-to-tcp/ |access-date=2025-04-24 |website=IONOS Digital Guide |language=en}}</ref><ref>{{Cite web |title=The TCP/IP Guide - TCP Connection Termination |url=http://www.tcpipguide.com/free/t_TCPConnectionTermination-2.htm |access-date=2025-04-24 |website=www.tcpipguide.com}}</ref>
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Transmission Control Protocol
(section)
Add topic