- Transmission Control Protocol
The Transmission Control Protocol (TCP) is one of the core protocols of the
Internet Protocol Suite. TCP is so central that the entire suite is often referred to as "TCP/IP." Whereas IP handles lower-level transmissions from computer to computer as a message makes its way across the Internet, TCP operates at a higher level, concerned only with the two "end systems", for example a Web browser and a Web server. In particular, TCP provides reliable, ordered delivery of a stream of bytes from one program on one computer to another program on another computer. Besides the Web, other common applications of TCP include file transfer. Among its management tasks, TCP controls message size, the rate at which messages are exchanged, and network traffic congestion.
Reason for TCP
TCP provides a communication service at an intermediate level between an application program and the
Internet Protocol(IP). That is, when an application program desires to send a large chunk of data across the Internet using IP, instead of breaking the data into IP-sized pieces and issuing a series of IP requests, the software can issue a single request to TCP and let TCP handle the IP details.
IP works by exchanging pieces of information called packets. A packet is a sequence of
bytesand consists of a "header" followed by a "body". The header describes the packet's destination and which routerson the Internet to use to pass the packet along—generally in the right direction—until it arrives at its final destination. The body contains the data which IP is transmitting. When IP is transmitting data on behalf of TCP, the contents of the IP packet body is TCP data.
Due to network congestion, traffic load balancing, or other unpredictable network behavior, IP packets can be lost or delivered out of order. TCP detects these problems, requests retransmission of lost packets, rearranges out-of-order packets, and even helps minimize network congestion to reduce the occurrence of the other problems. Once TCP at the receiving end has finally reassembled a perfect copy of the large data chunk originally transmitted, it passes that single chunk up to the application program at the receiving end. Thus, TCP greatly simplifies the application programmer's network communication task.
TCP is used extensively by many of the Internet's most popular application protocols and resulting applications, including the
World Wide Web, File Transfer Protocol, Secure Shell, and some streaming mediaapplications.
However, because TCP is optimized for accurate delivery rather than timely delivery, TCP sometimes incurs relatively long delays (in the order of seconds) while waiting for out-of-order messages or retransmissions of lost messages, and it is not particularly suitable for real-time applications such as
Voice over IP. For such applications, protocols like the Real-time Transport Protocol(RTP) running over the User Datagram Protocol(UDP) are usually recommended instead.cite book|last=Comer|first=Douglas E.|authorlink=Douglas Comer|title=Internetworking with TCP/IP:Principles, Protocols, and Architecture|publisher=Prentice Hall|date=2006|edition=5th|volume=1|isbn=0130905526]
TCP is a reliable stream delivery service that guarantees delivery of a data stream sent from one host to another without duplication or losing data. Since packet transfer is not reliable, a technique known as positive acknowledgment with retransmission is used to guarantee reliability of packet transfers. This fundamental technique requires the receiver to respond with an acknowledgment message as it receives the data. The sender keeps a record of each packet it sends, and waits for acknowledgment before sending the next packet. The sender also keeps a timer from when the packet was sent, and retransmits a packet if the timer expires. The timer is needed in case a packet becomes lost or corrupt.
TCP (Transmission Control Protocol) consists of a set of rules: for the protocol, that are used with the Internet Protocol, and for the IP, to send data "in a form of message units" between computers over the Internet. At the same time that the IP takes care of handling the actual delivery of the data, the TCP takes care of keeping track of the individual units of data "packets" (or more accurately, "segments") that a message is divided into for efficient routing through the net. For example, when an HTML file is sent to you from a Web server, the TCP program layer of that server takes the file as a stream of bytes and divides it into segments, numbers the segments, and then forwards them individually to the IP program layer. The IP program layer then turns each TCP segment into an IP packet by adding a header which includes (among other things) the destination IP address. Even though every packet has the same destination IP address, they can get routed differently through the network. When the client program in your computer gets them, the TCP stack (implementation) reassembles the individual segments and ensures they are correctly ordered as it streams them to an application.
TCP segment structure
A TCP segment consists of two sections:
The TCP header [http://freebie.fatpipe.org/~mjb/Drawings/TCP_Header.png] consists of 11 fields, of which only 10 are required. The eleventh field is optional (pink background in table) and aptly named "options".
* Source address – the one in the IPv6 header
* Destination address – the final destination; if the IPv6 packet doesn't contain a Routing header, that will be the destination address in the IPv6 header, otherwise, at the originating node, it will be the address in the last element of the Routing header, and, at the receiving node, it will be the destination address in the IPv6 header.
* TCP length – the length of the TCP header and data;
* Next Header – the protocol value for TCP
T/TCPvariant of TCP
TCP and UDP port
TCP and UDP port numbersfor a long list of ports/services
TCP congestion avoidance algorithms
Maximum transmission unit
Maximum segment size
Silly window syndrome
TCP Sequence Prediction Attack
TCP Tuningfor high performance networks
Path MTU discovery
tcphdr- the Unix TCP header structure in the C programming language
* Transport protocol comparison table
W. Richard Stevens. TCP/IP Illustrated, Volume 1: The Protocols. ISBN 0-201-63346-9
W. Richard Stevensand Gary R. Wright. TCP/IP Illustrated, Volume 2: The Implementation. ISBN 0-201-63354-X
W. Richard Stevens. TCP/IP Illustrated, Volume 3: TCP for Transactions, HTTP, NNTP, and the UNIX Domain Protocols. ISBN 0-201-63495-3
* [http://www.3wayhandshake.com TCP 3-Way Handshake Example]
* [http://edocs.tu-berlin.de/diss/2004/savoric_michael.htm Dissertation about TCP improvements in wired and wireless networks] (Dissertation)
* [http://www.iana.org/assignments/port-numbers IANA Port Assignments]
* [http://condor.depaul.edu/~jkristof/technotes/tcp.html John Kristoff's Overview of TCP (Fundamental concepts behind TCP and how it is used to transport data between two endpoints)]
* RFC 675 - Specification of Internet Transmission Control Program, December 1974 Version
* RFC 793 - TCP v4
* RFC 1122 - some error-corrections
* RFC 1323 - TCP-Extensions
* RFC 1379 - Extending TCP for Transactions -- Concepts
* RFC 1948 - Defending Against Sequence Number Attacks
* RFC 2018 - TCP Selective Acknowledgment Options
* RFC 2581 - TCP Congestion Control
* RFC 2988 - Computing TCP's Retransmission Timer
* RFC 4614 - A Roadmap for TCP Specification Documents
* [http://www.networksorcery.com/enp/protocol/tcp.htm TCP, Transmission Control Protocol]
* [http://www.medianet.kent.edu/technicalreports.html#TR2005-07-22 TCP EFSM diagram - A detailed description of TCP states.]
* [http://tcp.mywebcities.com/ The basics of Transmission Control Protocol]
* [http://www.joelonsoftware.com/articles/LeakyAbstractions.html The Law of Leaky Abstractions] by Joel Spolsky
* [http://mathforum.org/library/drmath/view/54379.html Checksum example]
Wikimedia Foundation. 2010.