Transmission control protocol

35
TRANSMISSION CONTROL PROTOCOL

description

This slide explains about the Transmission Control Protocol (TCP) concept in networking prepared by me and my friend Prem Kumar for a seminar.

Transcript of Transmission control protocol

Page 1: Transmission control protocol

TRANSMISSION CONTROL PROTOCOL

Page 2: Transmission control protocol

INTRODUCTION It is a connection oriented protocol.

It has Reliable feature for the services of IP.

It uses Flow and Error control mechanism at the transport level.

It creates a virtual connection between two TCPs to send data.

It does not support multicasting and broadcasting.

Page 3: Transmission control protocol

TCP Services

1. Process-to-Process Communication

2. Stream Delivery Service

3. Full-Duplex Communication

4. Connection-Oriented Service

5. Reliable Service

Page 4: Transmission control protocol

1.Process-to-Process Communication

TCP provides process to process communication using port number.

Port

Protocol Description

7 Echo Echoes a received datagram back to the sender

9 Discard Discards any datagram that is received

13 Daytime Returns the date and time

23 TELNET Terminal Network

25 SMTP Simple Mail Transfer Protocol

53 DNS Domain Name Server

67 BOOTP BootStrap Protocol

80 HTTP Hypertext Transfer Protocol

111 RPC Remote Procedure Call

Page 5: Transmission control protocol

2.Stream Delivery Service

TCP is a Stream-oriented protocol. It allows sending and receiving of data as a

stream of bytes. It needs buffer for storage in sending and

receiving sides. The sending side buffer has 3 chambers.1. Empty chamber to be filled by sending process.2. Holds the sent bytes until it is acknowledged.3. Contains bytes to be sent.

The receiver side buffer has 2 chambers.1. Empty chamber to be filled by the bytes received.2. Contains bytes that can be read by receiving process.

Page 6: Transmission control protocol
Page 7: Transmission control protocol

3.Full-Duplex Communication

In TCP data can flow in both the direction at the same time.

The segments move in both direction.

Page 8: Transmission control protocol

4.Connection-Oriented Service

In connection-oriented protocol the following occurs: The two TCPs establish a connection between

them. Data are exchanged in both the directions. The connection is terminated.

It is a virtual connection and not a physical one.

Page 9: Transmission control protocol

5.Reliable Service

TCP uses an acknowledgement mechanism to

check the safe and sound arrival of data.

Page 10: Transmission control protocol

TCP Features

1. Numbering System2. Flow Control3. Error Control4. Congestion Control

Page 11: Transmission control protocol

1.Numbering System

In TCP, there is no field for segment number. There are 2 fields called the sequence number

and acknowledged number which refers to byte number.

Byte Number- TCP numbers the data stored in sending buffer. It generates a random number between 0 and 232 -1. It is used for flow and error control.

Sequence Number- It is the first byte carried in the segment. It is not defined except for connection establishment, termination or abortion.

Acknowledgement Number- It is used to confirm the bytes it has received. It also defines the next byte number expected to be received.

Page 12: Transmission control protocol

2.Flow Control

The amount of data to be sent is controlled to prevent the receiver from overflow.

Page 13: Transmission control protocol

4.Error Control

It is used to provide reliable service. It is used in error detection. It is byte-oriented.

Page 14: Transmission control protocol

5. Congestion Control

The amount of data sent is determined by the level of congestion in the network .

Page 15: Transmission control protocol

Segment A packet in TCP is called a segment. It consists of a header followed data from

the application program. The header is 20 bytes without options

and up to 60 bytes with options.

Page 16: Transmission control protocol
Page 17: Transmission control protocol

Source port address- It is a 16-bit field which defines the port number of the application program that is sending the segment.

Destination port address- It is a 16-bit field which defines the port number of the application program that is receiving the segment.

Sequence number- It is a 32-bit field which defines the number assigned to the first byte of data contained in the segment.

Acknowledgement number- It is the 32-bit field which defines the byte number that the receiver of the segment is expecting to receive.

HLEN- This 4-bit field indicates the number of 4-byte words in the TCP header.

Reserved- This is a 6-bit field reserved for future use.

Page 18: Transmission control protocol

Control- It has 6 different control bits or flag that can be set. They are:

o URG- The value of the urgent pointer field is valid.o ACK- The value of the acknowledgement field is valid.o PSH- Push the data.o RST- To reset the connection.o SYN- Synchronize sequence numbers during connection.o FIN- Terminate the connection.

Window size- It is a 16-bit field which defines the size of the window in bytes.

Checksum- It is a 6-bit field same UDP but its inclusion is mandatory in TCP.

Urgent pointer- It is a 16-bit field which is used when a segment contains urgent data and it is valid only when the urgent flag is sent.

Options- There can be up to 40-bytes of optional information that in the TCP header.

Page 19: Transmission control protocol

TCP Connection TCP establishes a virtual path between

the source and destination. Transmission requires three phases:1. Connection Establishment2. Data Transfer3. Connection Termination

Page 20: Transmission control protocol

1.Connection Establishment

The data is being sent simultaneously when two TCPs are connected.

The two machines should get approval from the other party before the data is transferred.

Three-way handshaking- The connection establishment in TCP is called three-way hand shaking.

Page 21: Transmission control protocol
Page 22: Transmission control protocol

Simultaneous Open- It occurs when both processes issue an active open. In this case, both TCPs transmit a SYN+ACK segment to each other and one single connection is established between them.

SYN flooding attack-It is a serious security problem which happens when a attacker sends a large number of SYN segment to server , pretending that is coming from various clients by fake IP address. SYN+ACK segments are sent to fake clients and is lost so the server runs out of resources and may crash.

Some strategies to avoid the attack are:• Imposing limit on connection request.• Filtering out datagrams coming from unwanted

source.• Postpone resource allocation until the entire

connection is setup , using cookie.

Page 23: Transmission control protocol

2.Data Transfer Data and acknowledgement are carried in the

same segment and travel in the same direction.

Page 24: Transmission control protocol

Pushing data- The sending and receiving TCP buffers the data when they arrive and delivers them to the application program when ready or when it is convenient for the receiving TCP. So the efficiency of TCP increases.

Urgent data- Application program needs to send urgent bytes sometimes. The sending application program wants a piece of program to be read out. It is handled by URG bit.

Page 25: Transmission control protocol

3.Connection Termination Termination of a connection is usually

initiated by the client. It allows either three-way handshaking or

four-way handshaking.

Page 26: Transmission control protocol
Page 27: Transmission control protocol
Page 28: Transmission control protocol

Flow Control TCP uses a sliding window to handle flow

control. It is a technique whose primary purpose is to

properly match the transmission rate of the sender to that of the receiver and network.

The transmission should be high for good performance and protect against congestion.

The sliding window is byte oriented and size is variable.

Page 29: Transmission control protocol

The TCP sliding window spans a portion of the buffer containing bytes received from the process. The bytes inside the window are the bytes that can be in transit without worrying about acknowledgment. The imaginary window has two walls, left and right.

The window can be opened, closed, or shrunk. Opening a window moves the right wall to the right, thereby more bytes are eligible for sending. Closing the window moves the left wall to the right, which implies some bytes have been acknowledged. Shrinking the window moves the right wall to the left, preventing bytes to be sent.

The size of the window at one end is minimum of receiver window (rwnd) and congestion window (cwnd). The receiver window value is determined by the other end to act as flow control. The congestion window is a value determined by the network to avoid congestion.

Page 30: Transmission control protocol

Error Control It includes mechanism for detecting corrupted

segments, lost segments, out of order segments and duplicated segments.

Error detection and correction in TCP is achieved of three simple tools

1. Checksum 2. Acknowledgement3. Retransmission

Page 31: Transmission control protocol

1. Checksum TCP includes a mandatory 16-bit checksum in every segment, which is used to check for a corrupt segment. If corrupted, it is discarded by the destination TCP and is considered as lost.

2. Acknowledgement TCP uses acknowledgments to confirm the receipt of data segments. Control segments that carry no data but consume a sequence number are also acknowledged. ACK segments are never acknowledged and do not consume sequence number.

3.RetransmissionThe heart of error control mechanism is retransmission of segments. When a segment is corrupted, lost, or delayed, it is retransmitted. Currently, a segment is retransmitted either when a retransmission timer expires or when the sender receives three duplicate ACKs.• Retransmission after RTO• Retransmission after 3 duplicate ACKs• Out-of-order segments

Page 32: Transmission control protocol

Normal Operation—The client TCP sends one segment and the server TCP sends three. When the client receives the first segment from the server, it does not have any more data to send and sends only an ACK segment. The acknowledgment is delayed for 500 ms to see if any more segments arrive. When the timer matures, it triggers an acknowledgment. When the next segment arrives, another acknowledgment timer is set. However, before it matures, the third segment arrives. The arrival of the third segment triggers another acknowledgment.

Page 33: Transmission control protocol

Lost Segment—This scenario depicts the picture when a segment gets lost or corrupted, it is treated the same way by the receiver. A lost segment is discarded somewhere in the network (due to congestion). A corrupted segment is discarded by the receiver itself.In this scenario, the sender sends segments 1 and 2, which are acknowledged immediately by an ACK. Segment 3, is lost during transit. The receiver receives segment 4, which is out of order. The receiver stores the data in the segment in its buffer but leaves a gap to indicate that there is no continuity in the data. The receiver immediately sends an acknowledgment to the sender, displaying the next byte it expects. The receiver stores bytes 801 to 900, but does not deliver until the gap is filled.

Page 34: Transmission control protocol

Comparison between TCP & UDP

NO. TCP UDP

1. It is connection oriented. It is connectionless

2. It is byte stream. It is message stream.

3. It does not support multicasting and broadcasting.

It support broadcasting.

4. It provide error control &flow control.

It does not provide error control & flow control.

5. It supports full duplex transmission

It does not support full duplex transmission.

6. It is reliable. It is unreliable.

7. TCP packet is called segment.

UDP packet is called datagram.

Page 35: Transmission control protocol

THANK YOU!!!

Sundra AnandPrem Kumar.N