Download presentation
Presentation is loading. Please wait.
Published byTobias Francis Modified over 9 years ago
1
Transmission Control Protocol (TCP) BSAD 146 Dave Novak Sources: Network+ Guide to Networks, Dean 2013
2
Last time… Routing Static and Dynamic routing Routing Protocols EGPs BGP IGPs Focused on OSPF CIDR Do you understand the notation?
3
Outline Discuss role of layer 4 transport protocols from perspective of OSI model services Process-level communication TCP How different from IP Connection-based service Reliability aspects UDP
4
Transport protocols From OSI model perspective IP is a network layer protocol IP has its own layer (internetworking layer) in the TCP/IP model IP provides a universal routable address packet format Connectionless, best-effort service (unreliable service)
5
Transport protocols Layer 4 transport layer protocols work closely with layer 3 network layer protocols to provide additional services: You typically see protocols stacks (from various vendors) referred to by the primary layer 3 and 4 protocols in the stack Process-to-process communication End-to-end error control
6
Transport protocols IP focuses on host-to-host communication, not process-to-process communication What is process-to-process communication? Individual hosts run multiple processes at one time Multiple applications, utilities, etc. Must be some protocol to manage multiple processes between hosts
7
Transport protocols Layer 4 transport layer protocols are responsible for more refined or detailed management Process-to-process communication 2 transport layer protocols in TCP/IP protocol suite 1) 2)
8
Internet Protocol (IP) IP is connectionless Provides a generic, universal address format that is understood by all devices on the internet Independent of specific data link technologies Routes all IP datagrams independently No guarantee that packets will travel on same route to destination
9
Internet Protocol (IP) Allows for fragmentation and reassembly of datagrams Can subdivide datagrams to fit in any frame payload
10
Transmission Control Protocol (TCP) Connection-oriented service Establishes virtual connection between 2 hosts Provides reliable service Guaranteed delivery of data with acknowledgement from the receiver
11
Transmission Control Protocol (TCP) Point-to-point Establishes connections between two specific endpoints – single process running on sending host to single process running on receiving host
12
Transmission Control Protocol (TCP) Manage process-to-process communication Address out of order delivery Address packet loss Adjust routing based on network conditions (congestion control) Adjust how many packets are sent in a given time period (flow control) Establish an explicit “connection” between sender and receiver Address corrupt data
13
TCP Segments TCP uses same format for all messages (the segment “looks” the same regardless of the type of message) Data transmission ACK (acknowledgement) 3-way handshake (connection establishment and tear-down) All TCP messages called segments Segments encapsulated in IP datagram payload
14
TCP Encapsulation Layer 4 (TCP segment) Layer 3 (IP datagram) Layer 2 (Frame) IP datagram payload – TCP segment header becomes part of IP payload Frame payload – IP header placed in frame payload IP datagram header Frame header
15
TCP – Ports Transport layer protocol (TCP or UDP) identify the protocol or process that generated the data that will be sent over the network Often map this to a specific port number 1) On a computer, a place to be physically connected to another device (example, serial port, parallel port) 2) Using TCP/IP, a logical connection (a client application specifies an application on a remote computer (SOFTWARE) 3) In programming, to move an application for the development environment to be run in another environment
16
TCP – Ports Common internet applications are assigned specific, well-known port numbers TCP and UDP maintain their own separate lists of well-known ports
17
TCP – Examples of Common Ports You can visit http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers To view a list of well-known TCP and UDP port numbers
18
Sockets TCP/IP system addresses traffic to another system using combination of: 1) IP address 2) Port number This combination of IP address and port number is called a socket Sending socket – 137.99.101.55:4532 Receiving socket – 185.100.32.56:80
19
TCP – Sockets Don’t specify port number when typing URL because applications assume you are connecting to well known port numbers Your Web browser generally addresses all URLs to TCP port 80 – default HTTP port You could configure a Web server to operate on an alternate port – any users connecting to your Web server would need to know the port number and specify it http://www.privateserver.com:81
20
TCP Mapping the OSI and TCP/IP models Physical layer Transport layer Network layer Data Link layer Session layer Presentation layer Application layer 7 5 4 2 3 1 6 Network Interface layer Internet layer Transport layer Application layer FTP, HTTP, DHCP Binary, ASCII TCP IP LAN technology, cabling
21
TCP Services Major features of TCP Connection oriented Point-to-point communication Complete reliability Full duplex communication Connection startup and shutdown
22
Reliable service – what does this mean? Many types of problems can arise on a communications network Duplicate messages Out-of-order delivery Delayed messages Lost messages TCP employs a number of techniques to address these issues and provide “reliable” service
23
Achieving Reliability 4 components to TCP reliable service 1) 2) 3) 4)
24
1) Connection Establishment Before two systems exchange application layer data, a virtual connection between 2 processes on 2 hosts explicitly established Ensures both sender and receiver are: 1) Present (actually exist and are accessible) 2) Operating properly 3) Ready to receive data
25
1) Connection Establishment Connection implemented through software and remains alive during data exchange Then the connection terminated in an orderly, systematic fashion Usually a single file exchange
26
1 ) Connection Establishment Three-way handshake algorithm Systematic connection establishment and tear down requires an exchange of three messages SYN segment – synchronization segment for establishment FIN segment – for termination
27
1 ) Connection Establishment Three-way handshake algorithm Each system (sender on one end, receiver on the other) establishes separate connections running in opposite directions Full duplex protocol Each terminates separately
28
3-Way Handshake (initialization) Client initiatesServer 1) SYN 2) ACK + SYN 3) ACK 1) Client sends session Initialization request to server. Includes “plan” for transmission 2) Server sends back its starting sequence number and an acknowledgement 3) Client acknowledges receipt of server’s sequence number
29
Terminating Both Connections (tear down) Client initiatesServer 1) Client FIN 2) ACK 3) Server FIN 1) Client sends termination request to server 2) Server acknowledges that it has received client’s request 3) Server generates its own FIN message 4) Client acknowledges receipt of server’s FIN 4) ACK FIN and ACK cannot piggy back Server cannot include its FIN in the ACK sent to client
30
End-to-End Service Direct connection from process on one host to process on another host Set up connection Socket Exchange data Receiver knows exactly how much data to expect Close connection
31
2) Retransmission If data are lost, or there are problems, TCP can retransmit messages TCP allows multiple applications to communicate with multiple destinations at same time TCP must handle variety of delay scenarios and times that can change A timer is set to decide when to retransmit The retransmission timer can differ by application
32
2) Retransmission
33
Timer for retransmission depends on: Network congestion Distance to destination Bandwidth of link TCP can adapt to network conditions and to the needs of individual applications
34
Adaptive Retransmission TCP uses adaptive retransmission Monitors delay on each retransmission and adapts to accommodate changing conditions TCP estimates round trip time (RTT) for each active connection
35
Adaptive Retransmission Adapts by subtracting time message is sent from time ack is received Ack received 8:03:45:07 Message sent 8:03:45:02 8:03:45:07 - 8:03:45:02 = 0:0:0:05 Uses weighted moving average of RTT Weights most recent activity most heavily Adjusts to conditions on network
36
Adaptive Retransmission Fixed timeouts specifying retransmission times do not work well on a large internetwork Why would this be the case?
37
Adaptive Retransmission
38
3) Flow Control Managing the flow of data between two processes Why would this be important? What would happen if the sending computer is much faster and has a larger buffer than the receiving computer?
39
3) Flow Control TCP utilizes the sliding window scheme for flow control Connection established Each host allocates buffer to hold incoming data until it can be processed Size of buffer sent to other computer Remaining buffer size specified in ack when each transmission is received Sending computer adjusts amount of data it sends based on size of remaining buffer size If zero buffer remains, sending computer must stop transmitting until space is available
40
3) Flow Control
41
TCP window – amount of unacknowledged data the sender can send to a particular connection without receiving acknowledgement from the receiver When the window capacity is achieved, the sender MUST wait for acknowledgement before sending more data
42
3 ) Flow Control Offered window = TCP window # TCP segments receiving system is authorized to send before it must wait for ACK As receiver acknowledges bytes, left side of window moves to the right As receiver passes acknowledged bits up to application layer, right side of window moves to the right The offered window never can exceed 6 TCP segments
43
4) Congestion Control Managing amount of data being injected onto the network by specific host Why would this be important? What happens if switches and/or links become overloaded?
44
4 ) Congestion Control Packet loss and delay most often caused by congestion, not hardware failure TCP can exacerbate congestion problem through retransmission How (what happens if you add cars to an already congested freeway)?
45
4) Congestion Control Congestion collapse TCP uses packet loss as a measure of congestion measurement TCP determines how busy the network is by the number and frequency of lost packets
46
4 ) Congestion Control Simplified algorithm for congestion control When packet loss occurs, TCP immediately reduces number of packets sent to one (regardless of the maximum number it can send) If ack for single packet received, send 2 packets Receiver acknowledges successful receipt of data If ack for both packets received, send 4 packets Exponential increase, until half Send Window Size (max amount that can be sent) achieved Than cut back to a less aggressive increase
47
User Datagram Protocol (UDP) While TCP captures most of our attention, UDP is also widely used transport protocol in TCP/IP stack Process-to-process communication Connectionless datagram service Provides NO reliability Very little overhead
48
User Datagram Protocol (UDP) Communication consists of 2 messages Request and reply – there is no connection establishment
49
UDP If TCP provides reliability and UDP does not, why would UDP be used at all?
50
Summary Process-to-process communication TCP How different from IP Four reliability components UDP
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.