Network Services

Monday, November 25, 2013

The Transmission Control Protocol


The Transmission Control Protocol
TCP is the Transport layer of the protocol and serves to ensure a reliable, verifiable data exchange between hosts on a network. TCP breaks data into pieces, wraps the pieces with the information needed to identify it as a piece of the original message, and allows the pieces to be reassembled at the receiving end of the communications link. The wrapped and bundled pieces are called datagrams. Datagrams are also referred to as segments for TCP due to the way it often splits the original data into more manageable chunks. The most important information in the header includes the source and destination port numbers, a sequence number for the datagram, and a checksum.
      The source port number and the destination port number ensure that the data is sent back and forth to the correct application process running on each computer. The sequence number allows the datagrams to be rebuilt in the correct order in the receiving device, and the checksum allows the protocol to check whether the data sent is the same as the data received. It performs this last feat by running the bits of the segment through a complex polynomial expression and inserting the resulting number in the header. This is when IP enters the picture. Once the header is on the datagram, TCP passes the datagram to IP to be routed to its destination. The receiving device then performs the same calculation, and if the two calculations do not match, an error has occurred somewhere along the line and the datagram is silently discarded by the destination device and resent by the source device after its timer expires waiting for a positive acknowledgment that never arrives.

Figure 3.2 shows the layout of the datagram with the TCP header in place.
      In addition to the source and destination port numbers, the sequence number, and the checksum, a TCP header contains the following information:
Acknowledgment Number Indicates that the data was received successfully. If the datagram is damaged in transit, the receiver throws the data away and does not send an acknowledgment
back to the sender. After a predefined time-out expires, the sender retransmits the data for which no acknowledgment was received. Only positive forward acknowledgments are sent in TCP. Positive means that only successful transmissions are acknowledged. Forward means that the acknowledgment number represents the next sequence number the destination device expects to receive.
Offset Specifies the length of the header in 32-bit chunks.
Reserved This field specifies variables that are set aside for future use. This field must contain zeros. 
Flags These are six one-bit fields that indicate various things, such as whether this segment is the end of the higher-layer message, that the acknowledgment number is significant, that the sender is requesting that a virtual circuit with the receiver be established or torn down, or that the data in the segment is urgent.
Window Provides a way to increase the number of segments transmitted before the sender expects an acknowledgment, which improves efficiency in data transfers. Conversely, decreasing
the value of this field can indicate that network problems endanger the integrity of the data so more segments need to be acknowledged until conditions improve.
Urgent Pointer Gives the location in the segment where the urgent data ends, assuming the urgent data begins at the beginning of the segment. This allows out-of-band transmission of special
data, signifying to the receiving device that this data should be pushed ahead of any other that it has received but has not yet processed. Special data could include keyboard break sequences in
a Telnet session, which should immediately be processed by the receiving device in order to discontinue potentially harmful processing of previously received data. In light of this use, it makes
sense that the transmitting device would place such critical control information at the beginning of a new, emerging segment.

Options Communicates various parameters of the TCP virtual circuit. The only option originally specified in the TCP RFC (RFC 793) was maximum segment size, which has to be communicated
in the first segment during connection establishment. Later RFCs specify additional options. The latest list of TCP options can be found on the web site for the Internet Assigned Numbers Authority (www.iana.org/assignments/tcp-parameters).

Padding    Ensures that the header ends on a 32-bit boundary so that the offset field makes sense as a whole number. 

The data in the segment immediately follows this header information.


The Actual Use of TCP Communications
The following list summarizes the TCP process:

  • Flow control allows two systems to cooperate in datagram transmission to prevent overflows and lost segments.
  • Acknowledgment lets the sender know that the recipient has received the information.
  • Sequencing ensures that segments arrive in the proper order.
  • Checksums allow easy detection of corrupted segments.
  • Retransmission of lost or corrupted segments is managed in a timely way.





0 comments:

Post a Comment