See also: TCP
The Transmission Control Protocol ( TCP , “Transmission Control Protocol”), is a reliable protocol of transport, in connected mode, documented in RFC 793 of IETF.
In the model TCP/IP, TCP is located between the Couche of network (generally the protocol IP), and the Couche application. The applications transmit flows of Octet S on the network. TCP cuts out the flow of bytes in segments , whose size depends on MTU of the subjacent network (data link layer).
A session TCP functions in three phases:
The establishment of connection is done by a handshake in three times. The rupture of connection, it, uses a handshake in four times. During the phase of establishment of connection, parameters as the number of sequence are initialized in order to ensure the reliable transmission (without loss and in the order) of the data.
Out of bits
Significance of the fields:
Port source: Number of the port source
the customer sends a segment SYN to the waiter,
During this initial exchange, the numbers of sequence of the two parts are synchronized:
the customer uses his initial number of sequence in the field " Number of séquence" segment SYN (X for example),
During the phase of transfers of information, certain key mechanisms make it possible to ensure the robustness and the reliability of TCP. In particular, the numbers of sequence are used in order to order received segments TCP and to detect the lost data, the checksums allow the detection of errors, and the payments, as well as temporizations, allow the detection of the lost or delayed segments.
Thanks to the numbers of sequence and payment, the final systems can give the data received in the order to the recipient application.
The numbers of sequence are used to deduct the data in flow of bytes. One always finds two of these numbers in each segment TCP, which are the number of sequence and the number of payment . The number of sequence represents the proper number of sequence of transmitter TCP, while the number of payment represents the number of sequence of the recipient. In order to ensure the reliability of TCP, the recipient must discharge the segments received by indicating that it received all the data of the flow of bytes until a certain number of sequence.
For example, in the case of an exchange of segments by telnet:
the host has sends a segment to the host B containing a byte of data, a number of sequence equal to 42 (Seq = 42) and a number of payment equal to 79 (Ack = 79),
The numbers of sequence are integers not signed on 32 bit S, which total zero after having reached 2^32-1. The choice of the initial number of sequence is one of the keys of the robustness and the safety of connections TCP.
An improvement of TCP, named selective payment (selective acknowlegement or SACK), authorizes recipient TCP to discharge storage blocks received in the disorder.
A checksum on 16 bits, consisted the ones complement of the sum complémentée with one of all the elements of a segment TCP (heading and data), is calculated by the transmitter, and is included in the emitted segment. The recipient recomputes the sum of control of the received segment, and if it corresponds to the sum of control received, it is considered that the segment was received intact and without error.
The sum of control in addition to one used by TCP is relatively not very reliable according to the modern standards. This restricts the use of offering TCP to networks of the low error rates. If TCP were redefined today, one would probably use a CRC on 32 bits instead of the current mechanism. This unreliability of the sum of control is partially compensated by the frequent use of a CRC or a better control of integrity on level 2 (data link layer), below TCP and IP, such as for example in the screens PPP or Ethernet. However, that does not mean that the sum of control TCP is redundant: studies on the traffic Internet showed that one usually meets material errors and software which introduce errors into the packages between the nodes protected by CRC, and which the principle of nap of end-to-end control of TCP detects the majority of these errors.
The loss of a segment is managed by TCP by using a mechanism of temporization and retransmission. After the sending of a segment, TCP will await a certain time the reception of the corresponding ACK. A too short time involves a great number of useless retransmissions and a too long time slows down the reaction in the event of loss of a segment.
In the facts, the time before retransmission must be higher than the average RTT of a segment, i.e. at the time which a segment takes to carry out the return ticket between the customer and the waiter. As this value can vary in time, one " prélève" samples with regular interval and one calculates a weighted average of it:
Average RTT = (1-) * average RTT + * RTT sample
A typical value for is 0.125. The influence of the samples decreases in an exponential way in time.
The time to be used is obtained starting from this estimate of the average RTT and by adding a safety margin to it. More the difference between a sample and the average are large, more the safety margin to be envisaged is important. Calculation is done starting from the variance balanced between the sample and the average:
Variance RTT = (1-) * Variance RTT + * |RTT sample - average RTT|
A typical value for is 0.25. The time to be used is finally given by the following formula:
Time = average RTT + 4 * Variance RTT
Sometimes, when the time is too long, it is advantageous not to await before retransmettre a segment. If a host receives 3 ACKs for the same segment, then he considers that all the segments transmitted after the discharged segment were lost and retransmet thus immediately ( Fast retransmit ).
Each partner in a connection TCP has a plug of reception whose size is not unlimited. In order to prevent that a host does not overload the other, TCP envisages several control mechanisms of flow. Thus, each segment TCP contains the size available in the plug of reception of the host who sent it. In answer, the distant host will limit the size of the window of sending in order not to overload it.
Other algorithms like Nagle or Clarck also facilitate the control of flow.
The congestion intervenes when too many sources try to send too many data too quickly so that the network is able to transmit them. This involves the loss of many packages and long times.
Payments of the transmitted data, or the absence of payments, are used by the transmitters to interpret in an implicit way the state of the network between the final systems. Using temporizations, the transmitters and recipients TCP can modify the behavior of the data flow. It is what is called generally the control of congestion.
TCP uses a certain number of mechanisms in order to obtain a good robustness and high performances. These mechanisms include/understand the use of a slipping window, the algorithm of slow starting ( slow fox trot start ), the algorithm of avoidance of congestion ( congestion avoidance ), the algorithms of fast retransmission ( fast retransmit ) and of fast recovery ( fast recovery ), etc Of research are currently carried out in order to improve TCP to treat the losses effectively, to minimize the errors, to manage the congestion and to be fast in environments very high banc.
TCP uses the concept of number of port to identify the applications. At each end of connection TCP is associated a number with port on 16 bits assigned with the transmitting or receiving application. The ports can belong to three basic categories: well-known ports, recorded ports and dynamic/private ports. The well-known ports are assigned by IANA (Internet Assigned Numbers Authority) and are often used by processes system or having privileged rights. The well-known applications which function as a waiter and are on standby of connections generally use these types of ports. Examples: ftp (21), telnet (23), smtp (25) and HTTP (80). The recorded ports are generally used by user applications like transitory ports sources to be connected to a waiter, but they can also identify services not recorded by the IANA. The dynamic/private ports can also be used by user applications, but more rarely. They do not have a direction apart from a particular connection TCP.
However, TCP is not adapted for many applications, and new protocols of transport are created and deployed in order to fill some of its gaps. For example, of many applications in real-time do not need, and can even suffer, of the mechanisms of reliable transport of TCP. In this type of applications, it is often preferable to manage the losses, errors or congestions, rather than to try to avoid them. The applications of multi-media diffusion (audio and video, etc), or certain plays multi-players in real-time, for example, do not use TCP. Any application which does not require the reliability of TCP, or has a need limited in functionalities, can choose not to use it. In many cases, UDP (User Datagram Protocol) can be used in the place of TCP when only the services of multiplexing applicatifs are necessary.
RFC793
| Random links: | Animals (television channel) | Motonautism speed inshore | Sahaba | Xuxa | Johannes Smuts |