Chapter 12 Transmission Control Protocol

Slides:



Advertisements
Similar presentations
TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
Advertisements

CCNA – Network Fundamentals
Transmission Control Protocol (TCP)
UDP & TCP Where would we be without them!. UDP User Datagram Protocol.
Chapter 12 Transport protocols. Outline 12.1 introduction 12.2 TCP/IP protocol suite.
1 TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
1 CS 4396 Computer Networks Lab Transmission Control Protocol (TCP) Part I.
Transmission Control Protocol (TCP) Basics
BZUPAGES.COM 1 User Datagram Protocol - UDP RFC 768, Protocol 17 Provides unreliable, connectionless on top of IP Minimal overhead, high performance –No.
Transport Layer – TCP (Part1) Dr. Sanjay P. Ahuja, Ph.D. Fidelity National Financial Distinguished Professor of CIS School of Computing, UNF.
Chapter 7 – Transport Layer Protocols
TELE202 Lecture 14 TCP/UDP (2) 1 Lecturer Dr Z. Huang Overview ¥Last Lecture »TCP/UDP (1) »Source: chapter 17 ¥This Lecture »TCP/UDP (2) »Source: chapter.
UNIT 07 Process – to – Process Delivery: UDP,TCP and SCTP
Department of Electronic Engineering City University of Hong Kong EE3900 Computer Networks Transport Protocols Slide 1 Transport Protocols.
TCP. Learning objectives Reliable Transport in TCP TCP flow and Congestion Control.
Ch 23 Ameera Almasoud Based on Data Communications and Networking, 4th Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007.
Gursharan Singh Tatla Transport Layer 16-May
Process-to-Process Delivery:
TRANSPORT LAYER T.Najah Al-Subaie Kingdom of Saudi Arabia Prince Norah bint Abdul Rahman University College of Computer Since and Information System NET331.
6.1. Transport Control Protocol (TCP) It is the most widely used transport protocol in the world. Provides reliable end to end connection between two hosts.
TCP : Transmission Control Protocol Computer Network System Sirak Kaewjamnong.
University of the Western Cape Chapter 12: The Transport Layer.
TCP1 Transmission Control Protocol (TCP). TCP2 Outline Transmission Control Protocol.
Chapter 12 Transmission Control Protocol (TCP)
Chapter 12 Transmission Control Protocol (TCP). Outline  PROCESS-TO-PROCESS COMMUNICATION  TCP SERVICES  NUMBERING BYTES  FLOW CONTROL  SILLY WINDOW.
Chapter 24 Transport Control Protocol (TCP) Layer 4 protocol Responsible for reliable end-to-end transmission Provides illusion of reliable network to.
1 Kyung Hee University Chapter 12 Transmission Control Protocol.
Computer Networks23-1 PART 5 Transport Layer. Computer Networks23-2 Position of Transport Layer Responsible for the delivery of a message from one process.
NET 221D:COMPUTER NETWORKS FUNDAMENTALS Lecture : Transport Layer: Behrouz A. Forouzan” Data communications and Networking 1.
ECE 4110 – Internetwork Programming
© Jörg Liebeherr (modified by Malathi Veeraraghavan) 1 Overview Formats, Data Transfer, etc. Connection Management.
1 Kyung Hee University PART 5 Transport Layer. 2 Kyung Hee University Role of position of Transport Layer  Overseeing the delivery of data from a process,
1 Kyung Hee University Chapter 11 User Datagram Protocol.
McGraw-Hill Chapter 23 Process-to-Process Delivery: UDP, TCP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
TCP/IP1 Address Resolution Protocol Internet uses IP address to recognize a computer. But IP address needs to be translated to physical address (NIC).
1 TCP ProtocolsLayer name DNSApplication TCP, UDPTransport IPInternet (Network ) WiFi, Ethernet Link (Physical)
1 Transmission Control Protocol (TCP) RFC: Introduction The TCP is intended to provide a reliable process-to-process communication service in a.
Process-to-Process Delivery:
1 Kyung Hee University Chapter 12 Transmission Control Protocol.
3. END-TO-END PROTOCOLS (PART 1) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic University 22 March
Ch23 Ameera Almasoud 1 Based on Data Communications and Networking, 4th Edition. by Behrouz A. Forouzan, McGraw-Hill Companies, Inc., 2007.
Chapter 11 User Datagram Protocol
Chapter 9: Transport Layer
Fast Retransmit For sliding windows flow control we waited for a timer to expire before beginning retransmission of a packet TCP uses an additional mechanism.
Chapter 15 Transmission Control Protocol (TCP)
Chapter 15 Transmission Control Protocol (TCP)
5. End-to-end protocols (part 1)
Chapter 17 and 18: TCP is connection oriented
Transport Layer.
Process-to-Process Delivery, TCP and UDP protocols
Process-to-Process Delivery
TCP.
PART 5 Transport Layer Computer Networks.
TCP Transport layer Er. Vikram Dhiman LPU.
TCP - Part I Karim El Defrawy
TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
Chapter 14 User Datagram Protocol (UDP)
Process-to-Process Delivery:
CS4470 Computer Networking Protocols
Chapter 15 Transmission Control Protocol (TCP)
PART V Transport Layer.
Chapter 12 Transmission Control Protocol
PART 5 Transport Layer.
TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
Transport Protocols: TCP Segments, Flow control and Connection Setup
Lecture 21 and 22 5/29/2019.
Transport Protocols: TCP Segments, Flow control and Connection Setup
Process-to-Process Delivery: UDP, TCP
Transport Layer 9/22/2019.
Presentation transcript:

Chapter 12 Transmission Control Protocol Prof. Choong Seon HONG

Introduction Position of TCP

Introduction (cont’d) Responsibilities of Transport Layer to create a process-to-process communication using port numbers in case of TCP to provide a flow-and-error control mechanism at the transport level TCP uses sliding window protocol to achieve error control. TCP uses the acknowledgment packet, time-out, and retransmission to achieve error control. to provide a connection mechanism for the application program sending streams of data to the transport layer by application program making a connection with the receiver, chopping the stream into transportable units, numbering them and sending them one by one

Introduction (cont’d) At the receiving end, waiting until all the different units belonging to same application program have received, checking, passing those that are error free and delivering them to the receiving application program as a stream. After the entire stream has been sent, the transport layer should close the connection. TCP is called a connection-oriented, reliable transport protocol adding connection-oriented and reliability features to the services of IP

12.1 Process-to-Process Communication Host-to-host communication and process-to-process communication

Process-to-Process Communication (cont’d) Port Addresses (Numbers) process-to-process communication that achieved through the client/server paradigm to define the client and server programs, we need second identifiers called port numbers. integers between 0 and 65,535 The client program running on the local computer defines itself with a port number, chosen randomly by the TCP software running on the local host using a ephemeral port number But, the server program on the remote computer must also define itself with a port number using a well-known port number

Process-to-Process Communication (cont’d) Explanation of port numbers using TENET application

Process-to-Process Communication (cont’d) Well-known ports used by TCP

Process-to-Process Communication (cont’d) Socket Addresses To make a connection, needs 2 identifier : IP address + Port number  Socket address a pair of socket address Client socket address Server socket address

12.2 TCP Services TCP is a stream-oriented protocol Stream Delivery Service TCP is a stream-oriented protocol TCP creates an environment in which the two processes seem to be connected by an imaginary “tube” that carries their data across the Internet.

TCP Services (cont’d) Sending and Receiving Buffers Because the sending and receiving processes may not produce and consume data at the at the same speed, TCP needs buffers for storage. One way to implement is to use a circular array Not acknowledged

TCP Services (cont’d) Segments

TCP Services (cont’d) Stream Data Service (stream transport layer service) The sending TCP 1) accepts a stream of characters from sending application program 2) creates packets called segments, of appropriate size extracted from the stream 3) sends segments across the network The receiving TCP 1) receives segments, extracts data from segments 2) orders segments if they have arrived out of order 3) delivers segments as a stream of characters to the receiving application program

TCP Services (cont’d) For stream delivery, the sending and receiving TCPs use buffers the sending TCP uses sending buffer to store the data coming from the sending application program. the sending application program writes data to the buffer of the sending TCP the receiving TCP receives the segments and stores them in a receiving buffer the receiving application program uses the read operation to read the data from the receiving buffer. Since the rate of reading can be slower than the rate of receiving, the data is kept in the buffer until the receiving application reads it completely.

TCP Services (cont’d) Full-Duplex Service Reliable Service TCP offers full-duplex service After two application programs are connected to each other, they can both send and receive data. Piggybacking When a packet is going from A to B, it can also carry an acknowledgment of the packets received from B Reliable Service TCP uses the acknowledgment mechanism to check the safe and sound arrival of data

12.3 Segment The Unit of data transfer between two devices using TCP is a segment The format of a segment

Segment (cont’d) Source port address Destination port address defining the port number of application program in the host that is sending the segment Destination port address defining the port number of application program in the host that is receiving the segment Sequence number defining the number assigned to the first byte of data contained in this segment during the connection establishment, each party uses a random number generator to create an initial sequence number (ISN)

Segment (cont’d) Acknowledgment number Header length Reserved If the source of the segment has successfully received byte number x from the other party, it defines x+1 as the acknowledgment number Header length Indicating the number of 4-byte words in the TCP header the value between 5 and 15 (20 and 60 bytes) Reserved For future use

Segment (cont’d) Control Enabling flow control, connection establishment and termination, and mode of data transfer in TCP

Segment (cont’d) Description of flags in the control field

Segment (cont’d) Window size Checksum : see section 12.5 defining the size of the window, in bytes, that the other party must maintain. maximum size of window : 65,535 bytes Checksum : see section 12.5 Urgent pointer used when the segment contains urgent data defining the number that must be added to the sequence number to obtain the number of the last urgent byte in the data section of the segment Options : 40 bytes

12.4 Options Two categories of options Used to convey additional information to the destination or to align other options Two categories of options one-byte options multiple-byte options

Options (cont’d) End of option After this option, the receiver looks for the payload data End of options imparting 3 pieces of information to the destination No more options in the header The remainder of the 32-bit word is garbage Data from the application program starts at the beginning of the next 32-bit word

Options (cont’d)

Options (cont’d) No operation One-byte option used as a filler between options

Options (cont’d) Maximum segment size (MSS) defining the size of the biggest chunk of data that can be received by the destination of the TCP segment in spite of its name, defining the maximum size of the data, not the maximum size of the segment value of 0 to 65,535 bytes : default is 536 to be determined during the connection establishment phase by the destination of the segment used only in the segments that make the connections. Not used in the segments during data transfer

Options (cont’d) Window scale factor defining the size of the sliding window new window size = window size defined in the header x 2 window scale factor Determined in phase of the connection setup The largest value of scale factor allowed by TCP/IP is 16.

Options (cont’d) Timestamp 10-byte option The timestamp field is filled by the source when the segment leaves. When the destination sends an acknowledgment for the bytes in that segment, the destination enters the previously stored value in the echo reply field. The source, when it receives the acknowledgment, checks the current time versus this value The difference is the round-trip time.

12.5 Checksum The inclusion of the checksum in TCP is mandatory.

12.6 Flow Control Defining the amount of data that a source can send before receiving an acknowledgement from the destination. Sliding window For flow control, TCP uses a sliding window protocol The window covers a portion of the buffer that a host can send before worrying about an acknowledgment from other host

Flow Control (Cont’d) Sliding window Before receiving any acknowledgment from the destination the source can send up to 10 bytes

Flow Control (Cont’d) Sliding window with pointer

Flow Control (Cont’d) Window size in TCP is variable the size of the window can be increased or decreased depending on the advertisement by the destination Increasing the Window Size (depending on the advertisement by the destination)

Flow Control (Cont’d) Decreasing the Window Size (depending on the advertisement by the destination)

Flow Control (Cont’d) Window management TCP uses two buffers and one window to control the flow of data. The size of the window in the sending TCP is determined by the receiver and is announced in the ACK segments. usually the space left over in the receiving TCP buffer

Flow Control (Cont’d)

12.7 Error Control Including mechanisms for detecting corrupted segments, lost segments, out-of-order segments, and duplicated segments. Also, including a mechanism for correcting errors after they are detected. Error Detection and Correction Checksum Acknowledgment : TCP does not use negative acknowledgment Time-out

Error Control (Cont’d) Corrupted Segment

Error Control (Cont’d) Lost Segment

Error Control (Cont’d) Duplicate Segment can be created by a source TCP when the acknowledgment does not arrive before the time-out. Out-of-Order Segment Because of IP datagrams

Error Control (Cont’d) Lost Acknowledgment

12.8 TCP Timers To perform its operation smoothly, TCP uses the 4 timers

TCP Timers (Cont’d) Retransmission Timer To control a lost or discarded segment, when TCP sends a segment, it creates a retransmission timer for that particular segment. Calculation of Retransmission Time TCP uses the dynamic retransmission time-out that is different for each connection and which may be changed during the same connection Retransmission time = 2 x RTT Calculation of RTT : use of Timestamp option and Timer in sending TCP

TCP Timers (Cont’d) The value of RTT used in the calculation of the retransmission time of the next segment RTT =  x previous RTT + (1 -  ) current RTT where,  is usually 90 % Persistence Timer When acknowledgment with non-zero window size after zero window size is lost, to correct deadlock, TCP uses a persistence timer for each connection When the sending TCP receives an acknowledgment with a window size of zero, the persistence timer is started When persistence timer goes off, the sending TCP sends a special segment called a probe

TCP Timers (Cont’d) Persistence Timer (cont’d) KeepaliveTimer The probe alerts the receiving TCP that the acknowledgment was lost and should be resent. If a response is not received, the sender continues sending the probe segments and doubling, and resetting the value of the persistence timer until the value reaches a threshold (usually 60 seconds). KeepaliveTimer Used to prevent a long idle connection between two TCPs. Each time the server hears from a client, it resets this timer. Time-out is usually 2 hours. After 2 hours, sending 10 probes to client (each 75 secs), then terminates connection.

12.9 Connection connection establishment connection termination A connection-oriented protocol establishes a virtual path between the source and destination using two procedures : connection establishment connection termination Connection Establishment TCP transmits data in full-duplex mode. 4 functions between host A and host B Host A sends segment to announce its wish for connection and includes its initialization information about the traffic from A to B Host B sends a segment to acknowledge (confirm) the request of A Host B sends a segment that includes its initialization information about the traffic from B to A Host A sends a segment to acknowledge (confirm) the request of B can be combined into one step

Connection (cont’d) Three-way Handshaking Passive Open Active Open The sever program tells its TCP that it is ready to accept a connection It means that although its TCP is ready to accept any connection from any machine in the world it cannot make the connection itself. Active Open A client that wishes to connect to a server tells its TCP that it needs to be connected to a particular server.

Connection (cont’d) Three-way Handshaking Procedures

Connection (cont’d) 1. The client sends the first segment, a SYN segment. Including the source and destination port numbers, and client initialization sequence number (ISN) used for numbering the bytes of data sent from the client to the server Defining the wish of the client to make a connection with certain parameters. 2. The server sends the second segment, a SYN and ACK segment Including the ACK of receipt of the first segment The server must define also the client window size Used as the initialization segment for the server Containing the window scale factor option (if needed) to be used by the server and the MSS defined by the server

Connection (cont’d) 3. ACK segment Acknowledging the receipt of the second segment using the ACK flag and acknowledgment number field. Client must also define the server window size.

Connection (cont’d) Connection Termination (Four-way handshaking) 4 actions needed for closing the connection Host A sends a segment announcing its wish for connection termination Host B sends a segment acknowledging (confirming) the request of A. After this, the connection is closed in one direction. When host B has finished sending its own data, it sends a segment to indicate that it wants to close the connection. Host A acknowledges (confirms) the request of B

Connection (cont’d) Four-Way Handshaking

Connection (cont’d) Connection Resetting Resetting here means that the current connection is destroyed. When the TCP on one side has requested a connection to a nonexistent port, the TCP on the other side may send a segment with its RST bit set to annul the request. When one TCP wants to abort the connection due to an abnormal situation. It can send an RST segment to close the connection. 3. When the TCP on one side may discover that the TCP on the other side is idle for a long time. It may send an RST segment to destroy the connection.

12.10 State Transition Diagram To keep track of all the different events happening during connection establishment, connection termination,and data transfer, TCP software is implemented as a finite state machine A finite state machine is in a one of the states at any moment.

State Transition Diagram (Cont’d) States for TCP e

State Transition Diagram (Cont’d) A state transition diagram Server Client Unusual Input / Output Now connection is closed in one direction.

12.11 Congestion Control If a router receives packets faster than it can process them, congestion might occur, and some packets could be dropped. When a packet does not reach the destination, no acknowledgment is sent for it. The sender has no choice but to retransmit the lost packet. This may create more congestion and more dropping of packets, which means more retransmission and more congestion. Today, TCP protocols include that the sender’s window size is not only determined by the receiver but also by congestion window size Actual window size = minimum (receiver-advertised window size, congestion window size)

Congestion Control (cont’d) Window size increase strategy At the beginning of the connection, set the congestion window size to the maximum segment size

Congestion Control (cont’d) Window size increasing strategy If congestion occurs, the congestion window size must be decreased. The only way the sender can guess that congestion has occurred is through a lost segment The threshold must be set to half of the last congestion window size, and the congestion window size should start from one again.

12.12 TCP Operation Encapsulation and Decapsulation

TCP Operation (Cont’d) Queuing

TCP Operation (Cont’d) Multiplexing and Demultiplexing

TCP Operation (Cont’d) Pushing Data The application program on the sending site can request a push operation. Meaning that the sending TCP should not wait for the window to be filled TCP should create a segment and send it immediately. Sending TCP should also set psuh bit (PSH) to tell the receiving TCP that the segment includes data that must be delivered to the receiving application program as soon as possible and not to wait for more data to come.

TCP Operation (Cont’d) Urgent Data Sometimes, an application needs to send urgent bytes. Meaning that the sending application program wants a piece of data to be read out of order by the receiving application program The sending application program tells the sending TCP that the piece of data is urgent. Then, the sending TCP creates a segment and inserts the urgent data at the beginning of the segment. The urgent pointer field in the header defines the end of the urgent data and the start of normal data. When the receiving TCP receives a segment with the URG bit set, it extract the urgent data from the segment, using the value of the urgent pointer, and deliver it, out of order, to the receiving application program

12.13 TCP Design A TCP package involving a table called Transmission Control Blocks, a set of timers, and three software modules: main module, input processing module, output processing module.

TCP Design (Cont’d) Transmission Control Block (TCBs) To control the connection, TCP uses a structure to hold information about each connection. TCP keeps an array of TCBs in the form of a table

TCP Design (Cont’d) State : defining the state of the connection according to the state transition diagram Process : defining the process using this connection at this machine as a client or a server Local IP address : defining the IP address of the local machine used by this connection Local port number : defining the local port number used by this connection Remote IP address Remote port address Interface : defining the local interface Local window : holding information about the window at the local TCP Remote window

TCP Design (Cont’d) Sending sequence number Receiving sequence number Sending ACK number Time-out values : transmission time-out, persistence time-out, keepalive time-out, and so on Buffer size : defining the size of the buffer at the local TCP Buffer pointer : pointer to buffer where the receiving data is kept until is read by the application

TCP Design (Cont’d) Main Module : The main module is invoked by an arrived TCP segment, a time-out, or a message from an application program

TCP Design (Cont’d) Main Module (cont’d)

TCP Design (Cont’d) Main Module (cont’d)

TCP Design (Cont’d) Main Module (cont’d)

TCP Design (Cont’d) Main Module (cont’d)

TCP Design (Cont’d) Main Module (cont’d)

TCP Design (Cont’d) Main Module (cont’d)

TCP Design (Cont’d) Main Module (cont’d)

TCP Design (Cont’d) Main Module (cont’d)

TCP Design (Cont’d) Input processing module Output processing module handles all the details needed to process data or acknowledgment received when TCP is in the ESTABLISHED state sends an ACK if needed, takes care of the window size, does error checking, and so on Output processing module handles all the details needed to send out data received from application program when TCP is in the ESTABLISHED state handles retransmission time-outs, persistent time-outs, and so on