900 likes | 1.15k Views
Chapter 12. Transmission Control Protocol. TCP/IP protocol suite. 12.1 TCP SERVICES. It is connection –oriented protocol. It creates a connection between two TCPs to send data. Services provided by TCP/IP:. Process-to-Process Communication Stream Delivery Service
E N D
Chapter 12 TransmissionControl Protocol TCP/IP Protocol Suite
TCP/IP protocol suite TCP/IP Protocol Suite
12.1 TCP SERVICES • It is connection –oriented protocol. • It creates a connection between two TCPs to send data. Services provided by TCP/IP: Process-to-Process Communication Stream Delivery Service Full-Duplex Communication Connection-Oriented Service Reliable Service TCP/IP Protocol Suite
Like UDP, TCP provides process-to-process communication using port numbers. Well-known ports used by TCP TCP/IP Protocol Suite
Stream delivery • TCP allows the sending process to deliver data as a stream of bytes & allows the receiving process to obtain data as a stream of bytes. • TCP creates an environment in which two process seem to be connected by an imaginary tube that carries their data across the Internet. TCP/IP Protocol Suite
Sending and receiving buffers • Circular array of 1-byte location. • Sending & receiving buffer. TCP/IP Protocol Suite
TCP segments • Buffer handles disparity between speed of producing & consuming process. • Service provider for TCP send data in packets not in stream of bytes. • Segments are not of same size. TCP/IP Protocol Suite
Full Duplex Communication • As data can flow in both direction at the same time. • Connection Oriented Service • Like UDP, TCP first establish connection between sender & receiver, exchanged data in both direction, connection is terminated. • Reliable Service • It is reliable protocol, uses acknowledgement mechanism to check the safe 7 sound arrival of data. TCP/IP Protocol Suite
12.2 TCP FEATURES The features of TCP include: Numbering System: Sequence & acknwoledgment number Flow Control: The receiver of the data controls how much data are to be sent by the sender. Error Control: Implements an error control mechanism. Congestion Control: TCP takes into account congestion in the network. TCP/IP Protocol Suite
Note: The bytes of data being transferred in each connection are numbered by TCP. The numbering starts with a randomly generated number. TCP/IP Protocol Suite
Note: The value in the sequence number field of a segment defines the number of the first data byte containedin that segment. TCP/IP Protocol Suite
Note: The value of the acknowledgment field in a segment defines the number of the next byte a party expects to receive. The acknowledgment number is cumulative. TCP/IP Protocol Suite
12.3 SEGMENT • A packet in TCP is called a segment TCP/IP Protocol Suite
TCP segment format 20-60 Bytes TCP/IP Protocol Suite
Control field TCP/IP Protocol Suite
Description of flags in the control field I TCP/IP Protocol Suite
Pseudoheader added to the TCP datagram TCP/IP Protocol Suite
Note: The calculation of the checksum in TCP is mandatory. TCP/IP Protocol Suite
Encapsulation and decapsulation • A TCP segment is encapsulated in an IP datagram , which in turn is encapsulated in a frame at the data link layer. TCP/IP Protocol Suite
12.4 A TCP CONNECTION • TCP is connection-oriented. • A connection-oriented transport protocol establishes a virtual path between the source and destination. • A connection-oriented transmission requires three phases: connection establishment, data transfer, and connection termination. Three phases include: Connection Establishment Data Transfer Connection Termination Connection Reset TCP/IP Protocol Suite
Connection establishment using three-way handshaking TCP TCP/IP Protocol Suite
Note: A SYN segment cannot carry data, but it consumes one sequence number. TCP/IP Protocol Suite
Note: A SYN + ACK segment cannot carry data, but does consume onesequence number. TCP/IP Protocol Suite
Note: An ACK segment, if carrying no data, consumes no sequence number. TCP/IP Protocol Suite
Data transfer TCP/IP Protocol Suite
Connection termination using three-way handshaking TCP/IP Protocol Suite
Half-close In TCP one end can stop sending data while still receiving data, is called a half close. TCP/IP Protocol Suite
12.5 STATE TRANSITION DIAGRAM To keep track of all the different events happening during connection establishment, connection termination, and data transfer, the TCP software is implemented as a finite state machine. . TCP/IP Protocol Suite
States for TCP TCP/IP Protocol Suite
State transition diagram TCP/IP Protocol Suite
Common scenario(Connection Establishment & Termination) Maximum segment lifetime TCP/IP Protocol Suite
Note: The common value for MSL is between 30 seconds and 1 minute. TCP/IP Protocol Suite
Three-way handshake • FIN-WAIT-2 Eliminate. • The rest is same as four-way shaking. TCP/IP Protocol Suite
Simultaneous open • Both application (there is no client or server) issues active open. • Both ends need to send SYN segments to each other. • Both TCP goes through SYN-SENT & SYN-RCVD state before established state. TCP/IP Protocol Suite
Simultaneous close • Both end issue an active close. • Both TCP goes to the FIN-WAIT-1 state. • Eliminate the connection establishment & data transfer phase. TCP/IP Protocol Suite
Denying a connection • After resetting the connection, it goes to the LISTEN state to wait for another connection. • Client goes to CLOSED state. TCP/IP Protocol Suite
Aborting a connection • Process can abort a connection instead of closing it. • TCP sends RST+ACK segment • Both TCPs go to the CLOSED state. TCP/IP Protocol Suite
12.6 FLOW CONTROL • Flow control regulates the amount of data a source can send before receiving an acknowledgment from the destination. • TCP defines a window that is imposed on the buffer of data delivered from the application program. Sliding Window Protocol TCP/IP Protocol Suite
Sliding window • Host uses a window for sending a data. • The bytes inside the window are the bytes that can be in transmit. • The size of the window at one end, is determined by lesser of two values: receiver window(rwnd) or congestion window(cwnd). • Receiver window is no. of bytes the other end can accept before its buffer overflows & data is discarded. • Congestion window is a value determined by the network to avoid congestion. TCP/IP Protocol Suite
Note: A sliding window is used to make transmission more efficient as well as to control the flow of data so that the destination does not become overwhelmed with data. TCP’s sliding windows are byte oriented. TCP/IP Protocol Suite
Note: Some points about TCP’s sliding windows: ❏ The size of the window is the lesser of rwnd and cwnd.❏The source does not have to send a full window’s worth of data.❏ The window can be opened or closed by the receiver, but should not be shrunk.❏ The destination can send an acknowledgment at any time as long as it does not result in a shrinking window.❏ The receiver can temporarily shut down the window; the sender, however, can always send a segment of one byte after the window is shut down. TCP/IP Protocol Suite
12.7 ERROR CONTROL • TCP provides reliability using error control, which detects corrupted, lost, out-of-order, and duplicated segments. • Error control in TCP is achieved through the use of the checksum, acknowledgment, and time-out. The topics include: Checksum Acknowledgment Acknowledgment Type Retransmission Out-of-Order Segments Some Scenarios TCP/IP Protocol Suite
12.8 CONGESTION CONTROL • Congestion occurs if the no of packets sent to the network is greater than the capacity of the network. • Congestion control refers to the mechanisms and techniques to keep the load below the capacity. • Congestion happens in any system that involves waiting. TCP/IP Protocol Suite
Router queues TCP/IP Protocol Suite
Packet delay and network load TCP/IP Protocol Suite
Throughput versus network load TCP/IP Protocol Suite
Slow start, exponential increase TCP/IP Protocol Suite
Note: In the slow start algorithm, the size of the congestion window increases exponentially until it reaches a threshold. TCP/IP Protocol Suite
Figure 12.34Congestion avoidance, additive increase TCP/IP Protocol Suite
Note: In the congestion avoidance algorithm the size of the congestion window increases additively until congestion is detected. TCP/IP Protocol Suite