22.2 TRANSMISSION CONTROL PROTOCOL

 < Day Day Up > 



22.2 TRANSMISSION CONTROL PROTOCOL

Transmission Control Protocol (TCP) is a connection-oriented protocol that provides reliable communication across an internet. TCP is equivalent to ISO transport layer protocol.

The units of data exchanged between two end systems are called TCP segments. Ordinarily, TCP waits for sufficient data to be accumulated to create a TCP segment. This TCP segment is given to the IP layer. The TCP user (the application layer) can request the TCP to transmit data with a push flag. At the receiving end, TCP will deliver the data in the same manner. This mechanism is known as data stream push.

When urgent data is to be transmitted, urgent data signaling is used, which is a means of informing the destination TCP user that urgent data is being transmitted. It is up to the destination user to determine appropriate action. In the TCP segment, there is a field called urgent pointer to indicate that the data is urgent.

When a TCP connection is to be established between two end systems, commands are used from the TCP user (the higher layer protocol), which are known as TCP service request primitives. Responses, which are known as TCP service response primitives, are sent from the TCP to the TCP user.

The TCP service request primitives are:

  • "Fully specified passive open": Listen for connection attempt at specified security and precedence from specified destination. The following parameters are the arguments: source port, destination port, destination address, "time out", "time out action", "precedence", "security range". Parameters within the parentheses are optional.

  • "Active open": Request connection at a particular level of security and precedence to a specified destination.

  • "Active open with data": Request connection as in "Active Open" and transmit data with the request.

  • "Send": Transfer data across the named connection.

  • "Close": Close connection gracefully.

  • "Abort" Close connection abruptly.

  • "Status": Query connection status.

The TCP service response primitives (issued by TCP to local TCP user) are:

  • "Open ID": Inform TCP user of the connection name assigned to pending connection request.

  • "Open failure": Reports failure of an active open request.

  • "Deliver": Reports arrival of data.

  • "Closing": Reports that remote TCP user has issued a close and that all data sent by remote TCP user is delivered.

  • "Terminate": Reports that connection has been terminated. Reason for termination is provided.

  • "Response": Reports current status of connection.

  • "Error": Reports internal error.

Whenever a connection has to be established, the service request primitives are sent to the TCP, and the TCP sends the service response primitives. If there are no errors, a connection is established with the other TCP peer running on another machine, and data transfer takes place. After successful transfer of data, the application layer is informed by the TCP layer that the data has been successfully transferred.

start example

The TCP layer provides a connection-oriented service. A TCP connection is established between two end systems, and a series of service request primitives and service response primitives is exchanged for connection management, data transfer, and error reporting.

end example

22.2.1 Virtual Circuit Connection

Before two end systems transfer data, a TCP connection is established. This is a virtual circuit connection. A connection is established between the TCP protocol ports, which identify the ultimate destination within the machines. This connection is full duplex, so the data flows in both directions. Note that the TCP connection is only an abstraction; it is not a real connection because the IP datagrams take different routes to reach the destination.

Each connection is identified by a pair of end points. Each end point is defined by the host number and the port number. The host number is the IP address, and the port number is a predefined small integer. The port number is a process ID running on end systems—there will be no physical port. For instance, a connection can be represented by the two end points

start example

A TCP connection is identified by a pair of end points. Each end point is defined by the IP address (host number) and the port number. Port number is a predefined small integer.

end example

(125.34.5.7, 25) and (230.16.4.23, 53)

It is possible to establish multiple connections between two end points as shown in Figure 22.1. For instance, one of the above end points can have another connection such as

(125.34.5.7, 25) and (240.5.4.2, 53)

click to expand
Figure 22.1: Multiple TCP connections.

Hence, a given TCP port number can be shared by multiple connections.

22.2.2 TCP Segment Format

The TCP segment consists of the TCP header and protocol data unit (PDU) data. The format of the TCP header is shown in Figure 22.2. The minimum header length is 20 bytes.

click to expand
Figure 22.2: TCP segment format.

Source port address (16 bits): The port number that identifies the application program of the source.

Destination port address (16 bits): The port number that identifies the application program of the destination.

Sequence number (32 bits): The sequence number of the TCP segment.

Acknowledgement number (32 bits): The number of the octet that the source

Header length (4 bits): The length of the header in 32-bit words. This is required because the header length varies due to the presence of the options field.

Reserved (6 bits): Reserved for future use.

Code bits (6 bits): Specify the purpose and content of the segment. The six bits are URG, ACK, PSH, RST, SYN and FIN. If these bits are set, the following information is conveyed:

URG

Urgent pointer field is valid.

ACK

Acknowledgment field is valid.

PSH

The segment requests a push.

RST

Reset the connection.

SYN

Synchronize the sequence numbers.

FIN

Sender has reached end of its byte stream.

Window (16 bits): Specifies the buffer size, which indicates how much data it is ready to accept, beginning with the byte indicated in ACK field. This is flow control information.

Checksum (16 bits): Checksum is calculated from the header fields and the data fields. For checksum computation, the pseudoheader is used. The pseudoheader consists of 96 bits—32 bits of source IP address, 32 bits of destination IP address, 8 bits of zeros, 8 bits of protocol, and 16 bits of TCP length. This data is obtained from the IP layer software, and checksum is calculated using the same one's complement of 16-bit words and taking the one's complement of the result. The protocol field is to specify which underlying protocol is used; for IP, the value is 6.

start example

The TCP segment header consists of the following fields: source port address, destination port address, sequence number, acknowledgement number, header length, reserved bits, code bits, window size, checksum, urgent pointer and options. The minimum header length is 20 bytes.

end example

Urgent pointer (16 bits): This field is used to indicate that the data segment is urgent. The destination has to process this segment even if there are other segments to be processed. This is required in such applications as remote login, when the user has to abort a program without waiting any further.

Options, if any (variable): This field is used to negotiate the maximum TCP segment size. The TCP software can indicate the maximum segment size (MSS) in this field. Otherwise, a segment size of 536 bytes is used. This value is 576 bytes of default IP datagram minus the TCP and IP header lengths.

Padding (8 bits): Padding for making the TCP segment complete.

Data (variable): User data, which is of variable length.

22.2.3 TCP Mechanism

For data transfer, there will be three phases: connection establishment, data transfer, and connection termination.

Connection Establishment

The connection is determined by the source and destination ports. Some of the important currently assigned TCP port numbers are given in the following table:

Port number

Application

Description

21

FTP

File Transfer Protocol

23

Telnet

remote login

25

SMTP

Simple Mail Transfer Protocol

37

time

time

42

nameserver

hostname server

53

domain

Domain Name Server

79

Finger

Finger

80

HTTP

World Wide Web

103

x400

X.400 messaging service

113

auth

authentication service

Only one TCP connection is established between a pair of ports. However, one port can support multiple connections, each with a different partner port as shown in Figure 22.1. Handshaking is used for establishing the connection using the following procedure:

  • Sender sends a request for connection with sequence number.

  • Receiver responds with request for connection with ACK flag set.

  • Sender responds with ACK flag set.

Data Transfer

The data is transferred in segments but viewed as a byte stream. Every byte is numbered using modulo 232. Each segment contains the sequence number of the first byte in the data field. Flow control is specified in the number of bytes. Data is buffered by the sender and the receiver, and when to construct a segment is at the discretion of the TCP (except when push flag is used). For priority data, an urgent flag is used. If a segment arrives at a host and the segment is not meant for it, an rst flag is set.

Connection Termination

Each TCP user issues a close primitive. TCP sets the fin flag on the last segment. If the user issues an abort primitive, abrupt termination is done. All data in buffers is discarded and an rst segment is sent.

To implement the TCP, there are a few implementation options, which are briefly discussed.

Send policy: When does the TCP layer start sending the data to the layer below? One option is to buffer the data and construct the TCP segment. The other option is not to buffer the data and construct the TCP segment when some data is available to be sent to the layer below.

Delivery policy: After the data is received from the layer below, when to transfer the data to the upper layer (the TCP user) is another issue. One option is to buffer the TCP segment and send to the TCP user. The other option is to send without buffering. When to deliver is a performance consideration.

start example

A TCP connection is established between two TCP ports on two end systems. Only one connection can be established between a pair of ports. However, one port can support multiple connections, each with a different partner port.

end example

Accept policy: If segments are received out of sequence, there are two options:

  • In-order: accept only segments received in order, discard segments that are received out of order. This is a simple implementation but a burden on the network.

  • In-window: accept all segments that are within the receive window. This reduces the number of transmissions, but a buffering scheme is required at the hosts.

Retransmit policy: Three retransmission strategies are possible.

  • First only: The sender maintains a timer. If ACK is received, the corresponding segment is removed from the buffer and the timer is reset. If the timer expires, the segment at the front of the queue is retransmitted and the timer is reset.

  • Batch: The sender maintains one timer for retransmission for the entire queue. If ACK is received, segments are removed from the buffer and the timer is reset. If the timer expires, all segments in the queue are retransmitted and the timer is reset.

  • Individual: The sender maintains one timer for each segment in the queue. If ACK is received, the segments are removed from the queue and the timers are reset. If any timer expires, the corresponding segment is retransmitted individually and the timer is reset.

Acknowledgement policy: There are two options here.

  • Immediate: When data is accepted, immediately transmit empty segment with ACK number. This is simple but involves extra transmissions.

  • Cumulative: When data is accepted, wait for outbound segment with data in which ACK is also sent (called piggybacking the ACK). To avoid long delay, a window timer is set. if the timer expires before ACK is sent, an empty segment containing ACK is transmitted. This involves more processing but is used extensively due to a smaller number of transmissions.

    Implementation of TCP in software gives the software developer these choices. Based on the delay considerations and bandwidth considerations, one choice may be better than the other.

Note 

The port number is a predefined integer for each application that runs above the TCP layer. Some important port numbers are: 21 for FTP, 25 for SMTP, and 80 for HTTP.



 < Day Day Up > 



Principles of Digital Communication Systems and Computer Networks
Principles Digital Communication System & Computer Networks (Charles River Media Computer Engineering)
ISBN: 1584503297
EAN: 2147483647
Year: 2003
Pages: 313
Authors: K V Prasad

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net