Sei sulla pagina 1di 25

MITA DUTTA Electrical Engineering Department Jadavpur University

Transport Control Protocol


Transmission Control Protocol (TCP) is a connectionoriented protocol that provides highly 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. 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
1

MITA DUTTA Electrical Engineering Department Jadavpur University

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.

Services Of The Transport Layer


To transfer a file from one system to another system, a networking software first has to establish a connection with the other end system, transfer the file, and then remove the connection. The transport layer provides the necessary functionality to establish the connection, transfer the packets to the other system reliably even if there are packet losses because of the IP's limitations, and then remove the connection. The transport layer protocol does this job by providing the following services:
2

MITA DUTTA Electrical Engineering Department Jadavpur University

Type of service Quality of service Data transfer Connection management Expedited delivery Status reporting

Type of service: The service can be connection-oriented or


connectionless. In connection-oriented service, flow control and error control are incorporated so that the service is more reliable and sequence of packets is maintained. However, there is an overhead to connection establishment. In connectionless service, there are no overheads for connection establishment and so it is efficient, but reliable data transfer is not guaranteed. Connectionless service is
3

MITA DUTTA Electrical Engineering Department Jadavpur University

used

for

applications

such

as

telemetry,

real-time

applications such as audio/video communication, and so on. On the Internet, TCP provides connection-oriented service, and UDP provides connectionless service.

Quality of service: Depending on the application, the


quality of service parameters have to be defined, such as acceptable error levels, desired average and maximum delay, desired average and minimum throughput, and priority levels. The quality of service parameters are very important when transmitting voice or video data because delay, packet loss, and so on will have an impact on the quality of the speech or video.

MITA DUTTA Electrical Engineering Department Jadavpur University

Data transfer: This service defines whether the data


transfer is full duplex, half duplex, or simplex. Transfer of data and control information is the function of this service. In some communication systems, the communication can be only one way (simplex). In such a case, it is not possible to transmit acknowledgements at all. UDP can be used in such systems.

Connection management: In connection-oriented service,


the transport layer is responsible for establishment, maintaining and termination of the connection. In case of abrupt termination of a connection, data in transit may be lost. In case of graceful termination, termination is prevented until data has been completely delivered.
5

MITA DUTTA Electrical Engineering Department Jadavpur University

Expedited delivery: When some urgent data is to be sent, the interrupt mechanism is used to transfer the urgent data. Status reports: Status reporting of performance

characteristics is also done by this layer. The performance characteristics are delay, throughput, and degradation in quality of service.

TCP Connection Establishment Process


The normal process of establishing a connection between a TCP client and server involves three steps: the client sends a SYN message; the server sends a message that combines an ACK for the clients SYN and contains the servers SYN; and then the client sends an ACK for the servers SYN. This is called the TCP three-way handshake.
6

MITA DUTTA Electrical Engineering Department Jadavpur University

Client Start State The CLOSE client cannot D do anythin g until the server has perfor med a passive OPEN and is ready to accept a connect ion. Step #1 CLOSE Transm Action Move to State Start State

Server Action Move to State

The CLOSE server LISTEN perfor D ms a passive OPEN, ready itself for the receipt of a connect ion request (SYN) from a client.

SYN7

The server

MITA DUTTA Electrical Engineering Department Jadavpur University

it: The client perfor ms an active OPEN, and sending a SYN messag e to the server.

SENT

LISTEN waits for contact from a client.

SYNSENT

The client waits to receive an ACK to the SYN it has sent, as well as the server's SYN.

Step #1 LISTEN Receive SYN, Step RECEIV #2 ED Transm it: The server receives the SYN from the client. It sends
8

MITA DUTTA Electrical Engineering Department Jadavpur University

a single SYN+A CK messag e back to the client that contain s an ACK for the client's SYN, and the server's own SYN.

SYNSENT

Step ESTABL SYN- The #2 ISHED RECEIV server Receiv waits ED e, Step for an #3 ACK to Trans the SYN mit: it sent
9

MITA DUTTA Electrical Engineering Department Jadavpur University

The client receives from the server the SYN+A CK containi ng the ACK to the client's SYN, and the SYN from the server. It sends the server an ACK for the server's SYN. The
10

previou sly.

MITA DUTTA Electrical Engineering Department Jadavpur University

client is now done with the connect ion establis hment.

ESTABL The ISHED client is waiting for the server to finish connect ion establis hment so they can operate normall y.

SYN- Step ESTABL RECEIV #3 ISHED Receiv ED e: The server receives the ACK to its SYN and is now done with connect ion establis hment.
11

MITA DUTTA Electrical Engineering Department Jadavpur University

ESTABL The ISHED client is ready for normal data transfer operati ons.

ESTABL The ISHED server is ready for normal data transfer operati ons.

12

MITA DUTTA Electrical Engineering Department Jadavpur University

Fig. illustrates how a conventional connection is established between a client and server, showing the three messages sent during the process and how each device transitions from the CLOSED state through intermediate states until the session is ESTABLISHED.

TCP Segment Format

13

MITA DUTTA Electrical Engineering Department Jadavpur University

Source Port (2 bytes) : The 16-bit port number of the process that originated the TCP segment on the source device. This will normally be client port number for a request sent by a client to a server.

Destination Port (2 bytes): The 16-bit port number of the intended recipient of the message on the destination device.

14

MITA DUTTA Electrical Engineering Department Jadavpur University

Sequence Number (4 bytes): This field carries the initial sequence number (ISN) of the source TCP segment.

Acknowledgment Number (4 bytes): This field contains a sequence number, the sender of the packet expects to receive.

Data Offset / Header length (4 bits): The length of the TCP header. Reserved (6 bits): Reserved for future use, sent as zero.

Control Bits (6 bits): This field contains variety of control information, including, the SYN & ACK bits used for connection establishment and FIN used for connection

15

MITA DUTTA Electrical Engineering Department Jadavpur University

termination. URG (1bits): When set to 1, indicates that the priority data transfer feature has been invoked for this segment and the urgent pointer field is valid. ACK (1 bits): When set to 1, indicates that this segment carries an acknowledgement and the acknowledgement number field is valid. PSH (1 bits): The sender using the TCP push feature, requesting that the data in this segment be immediately pushed to the application on the receiving device. RST (1 bits): The sender has encountered a problem and wants to reset the connection. SYN (1 bits) : This segment is a request to synchronize sequence number and establish a connection, the sequence
16

MITA DUTTA Electrical Engineering Department Jadavpur University

number field contains the initial sequence number of the sender of the segment. FIN (1 bits): The sender of the segment is requesting that the connection be closed. Window (16 bits): This field corresponds to the current size of the buffer allocated to accept data for this connection. This field is, in other words, the current receive window size for the device sending this segment, which is also the send window for the recipient of the segment.

Checksum (16 bits): A 16-bit checksum for data integrity protection, computed over the entire TCP data plus header. It is used to protect the entire TCP segment against errors in transmission.
17

MITA DUTTA Electrical Engineering Department Jadavpur University

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.

Options (variable): Options may occupy space at the end of the TCP Header. This field is used to negotiate the maximum TCP segment size. The TCP software can indicate the maximum segment size (MSS) in this field. The default segment size is 536 bytes.

Padding (8 bits) : If the Options field is not a multiple of 32 bits in length, enough zeroes are added to pad the header so it is a multiple of 32 bits.
18

MITA DUTTA Electrical Engineering Department Jadavpur University

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

TCP Connection Termination A TCP connection is normally terminating using a special procedure where each side independently closes its end of the link. It normally begins with one of the application processes signalling to its TCP layer that the session is no longer needed. That device sends a FIN message to tell the other device that it wants to end the connection, which is acknowledged. When the responding device is ready, it too sends a FIN that is acknowledged; after waiting a period of time for the ACK to be received, the session is closed.

19

MITA DUTTA Electrical Engineering Department Jadavpur University

Fig. TCP Connection Termination Procedure This diagram shows the conventional termination procedure for a TCP session, with one device initiating termination and
20

MITA DUTTA Electrical Engineering Department Jadavpur University

the other responding. In this case the client initiates; it sends a FIN which is acknowledged by the server. The server waits for the server process to be ready to close and then sends its FIN, which is acknowledged by the client. The client waits for a period of time to ensure that its ACK is received, before proceeding to the CLOSED state.

USER DATAGRAM PROTOCOL

User datagram protocol (UDP) is another transport layer protocol that can be run above the IP layer. In the place of TCP, UDP can be used to transport a message from one machine to another machine, using the IP as the underlying protocol. UDP provides an unreliable connectionless

21

MITA DUTTA Electrical Engineering Department Jadavpur University

delivery service. It is unreliable because packets may be lost, arrive out of sequence or be duplicated. It is the higher layer software that has to take care of these problems. The advantage of UDP is that it has low protocol overhead compared to TCP. A UDP message is called a user datagram.

Fig. UDP datagram format. Source port address (16 bits): Specifies the protocol port address from which data is originating. This is an optional field. If present, this is to indicate the address to which a
22

MITA DUTTA Electrical Engineering Department Jadavpur University

response has to be sent by the destination port. If absent, the field should contain all zeros. Destination port address (16 bits): Specifies the protocol port address to which data is intended. Message length (16 bits): Specifies the length of the user datagram, including the header and data in octets. Checksum (16 bits): Checksum calculation is optional, and can be avoided by keeping zeros in this field to reduce computational overhead. Data (variable length): The actual data of the user datagram. This user datagram is encapsulated in the IP datagram's
23

MITA DUTTA Electrical Engineering Department Jadavpur University

data field and then encapsulated in the frame of the datalink layer and sent over the network. Though UDP is unreliable, it reduces the protocol overhead as compared to TCP. Hence UDP is also used for voice/fax/video communication on IP networks to enable real-time transmission.

24

MITA DUTTA Electrical Engineering Department Jadavpur University

25

Potrebbero piacerti anche