TCP Connection Management (2)

Source: Internet
Author: User
Tags ack

Connections and translators

Nat

TCP Options

Every option begins with a 1-byte kind that specifies the type of option.

Options that is not understood is simply ignored, according to [RFC1122].

The options with a kind value of 0 and 1 occupy a single byte. The other options has a len byte that follows the kind byte.

The length is the total length, including the kind and Len bytes.

The reason for the NOP -option is-allow the sender of the "to pad" to a multiple of 4 bytes, if it needs to.

Remember that the TCP header ' s length was always required to be a multiple of the "A," the TCP header L Ength Field uses that unit.

The EOL option indicates the end of the list and that no further processing of the options list are to be performe D.

Maximum Segment Size (MSS) Option

The maximum segment size (MSS) is the largest segment , a TCP is willing to receive from its peer and , consequently, the largest size its peer should ever use when sending.

The MSS value counts only TCP data bytes and does does include the sizes of any associated TCP o R IP Header

When a connection are established, each end usually announces their MSS in an MSS option carried with its SYN SE Gment.

The option allows for (8* (4-2)) bits is used to specify the MSS value. If No MSS option is provided, a default value of 536 bytes is used.

Note the MSS option is a negotiation between one TCP and its peer; It is a limit.

When one TCP gives their MSS option to the other, it's indicating its unwillingness to accept any segments larger than that size for the duration of the connection.

Selective Acknowledgment (SACK) Options

Because it uses cumulative ACKs, TCP is never able to acknowledge data it had received correctly but that's not Conti Guous, in terms of sequence numbers, with data it has received previously.

In such cases, the TCP receiver was said to having holes in its received data queue.

A receiving TCP prevents applications from consuming data beyond a hole because of the byte stream abstractio n it provides.

If a TCP sender were able to learn of the existence of holes (and out-of-sequence data blocks beyond holes in th E sequence space) at the receiver,

It could better select which particular TCP segments to retransmit when segments is lost or otherwise missing at The receiver.

The TCP selective acknowledgment (SACK) options [rfc2018][rfc2883] provide this capability.

The scheme works effec-tively, however, only if the TCP sender logic was able to make effective use of the SACK I Nformation it receives from a sack-capable receiver.

A TCP learns that it peer is capable of advertising SACK information by receiving the sack-permitted optioN in a SYN (or SYN + ACK) segment.

SACK information contained in a SACK option consists of a range of sequence numbers representing data bl Ocks the receiver has successfully received.

Each of the range is called a SACK block and are represented by a pair of 32-bit sequence numbers.

Thus, a SACK option containing n SACK blocks is (8n + 2) bytes long. The bytes is used to the kind and length of the SACK option.

Because of the limited amount of space available in the option space of a TCP header, the maximum number of SACK Blocks available to being sent in a mono seg-ment is three

Window scale (Wscale or wsopt) Option

The Window scale option (denoted Wscale or wsopt) [RFC1323] effectively increases the capacity of the TCP Win Dow advertisement field from-to-about-bits.

Instead of changing the field size, however, the header still holds a 16-bit value, and an option are defined that Applies a scaling factor to the 16-bit value.

This factor effectively left-shifts , the Window field value by the scale factor.

The 1-byte shift count is between 0 and (inclusive).

The maximum scale value of provides for a maximum window of 1,073,725,440 bytes (65,535x214), close to 1,073,741,823 (1), effectively 1GB.

TCP then maintains the "real" window size internally as a 32-bit value.

This option can appear-only with a SYN segment, so the scale factor is fixed for each direction when the CO Nnection is established.

To enable window scaling, both ends must send the option in their SYN segments.

The end doing the active open sends the option in it SYN, but the end doing the passive open can send the option Only if the received SYN specifies the option.

The scale factor can is differ-ent in each direction.

If the end doing the active open sends a nonzero scale factor but does not receive a Window scale option from the Other end, it sets their send and receive scale values to 0.

This lets systems understand, the option interoperate with systems.

The shift count is automatically chosen by TCP, based on the size of the receive BuffeR.

The size of this buffer was set by the system, but the capability are normally provided for the application to change it.

The Window scale option was most relevant when TCP was used to provide bulk data transfer through networks with LA Rge-bandwidth-delay products (i.e., those with a product of round-trip time and bandwidth being relatively).

Timestamps Option and Protection against wrapped Sequence Numbers (PAWS)

The timestamps option (sometimes called the Timestamp option and written as TSopt or TSopt) lets the sender place 4-byte timestamp values in every seg-ment.

The receiver reflects these values in the acknowledgment, allowing the sender of calculate an estimate o f The connection ' s RTT for each ACK received.

When using the Timestamps option, the sender places a 32-bit value of the Timestamp value field (called TSV or tsval) in T He first part of the TSopt,

And the receiver echoes this back unchanged in the second Timestamp Echo Retry field (called TSER or TSECR). "Relative meaning"

The main reason for wishing to calculate a good estimate of the connection's RTT is to set the retransmission timeout, which tells TCP when it should try resending a segment the is likely lost.

Prior to the creation of the timestamps option, most TCPs would perform just one RTT sample per window of data.

With the timestamps option, More samples can is taken, leading to the potential of a better RTT estimate

...

We say "for this purpose" because although the timestamps option allows for more frequent RTT samples,

It also provides a-on-the-receiver to avoid receiving-old segment S and considering them as valid.

This is called Protection against wrapped Sequence Numbers (PAWS)

The 32-bit Sequence Number field wraps between times D and E.

We assume that one segment gets lost at time B and is retransmitted. We also assume that the lost segment reappears at time F.

This assumes the time difference between the segment getting lost and reappearing are less than the maximum time a seg -ment can live in the network (called the MSL; see section 13.5.2);

Otherwise the segment would has been discarded by some router when its TTL expired.

As we mentioned earlier, it is only with relatively high-speed connections the This prob-lem appears, where old Segments can reappear and contain sequence numbers currently being transmitted.

We can also see from Table 13-2 that using the Timestamps option prevents this problem.

The receiver considers the timestamp as a 32-bit extension of the sequence number.

Because The lost segment that reappears at time F have a time-stamp of 2, which is less than the most recent valid timestamp (5 or 6), it is dis-carded by the PAWS algorithm.

The PAWS algorithm does not require any form of time synchronization between the sender and the receiver.

All the receiver needs are for the timestamp values to being monotonically increasing, and to increase by at LEAs T 1 per window of data.

User Timeout (UTO) Option

The UTO value (also called user_timeout) specifies the amount of time a TCP sender is willing-wait for an ACK of outstanding data before con-cluding that the remote end have failed.

User_timeout have traditionally been a local configuration parameter for TCP [RFC0793].

The UTO option allows one TCP to signal it user_timeout value to its connection peer.

This allows the receiv-ing TCP to adjust their behavior (e.g., to tolerate a longer period of disrupted con-necti Vity prior to aborting a connection).

UTO option values is advisory; Just because one end of a connection might wish to use a large or small UTO value does not mean that the other end needs T o comply.

UTO options included on SYN segments when a connection is estab-lished,

On the first Non-syn segments, and whenever the User_timeout value is changed.

As a relatively new option, it is not yet widely deployed.

Authentication Option (Tcp-ao)

There is a option used to enhance the security of TCP connections.

Path MTU Discovery with TCP

MTU Concept (TODO)

TCP State Transitions

TCP State Transition Diagram

States is indicated by ovals and transitions between states by arrows

TCP Connection Management (2)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.