Chapter 12 The Transport Layer TCP UDP TCP

  • Slides: 33
Download presentation
Chapter 12 The Transport Layer • TCP & UDP • TCP Connection Methods

Chapter 12 The Transport Layer • TCP & UDP • TCP Connection Methods

Purpose of Transport Layer “quality of service” The phrase __________ is often used to

Purpose of Transport Layer “quality of service” The phrase __________ is often used to describe the purpose of Transport Layer The primary duties of Layer 4 are to transport and regulate the flow of information from source to destination reliably and accurately

Layer 4 Protocols OSI TCP/IP Application Presentation Application Session Transport Network Internet Data Link

Layer 4 Protocols OSI TCP/IP Application Presentation Application Session Transport Network Internet Data Link Physical Network Interface

Layer 4 Protocols TCP/IP Application Transport Internet Network Interface TCP (Transmission Control Protocol) UDP

Layer 4 Protocols TCP/IP Application Transport Internet Network Interface TCP (Transmission Control Protocol) UDP (User Datagram Protocol)

TCP • Connection-oriented • Reliable • Divides outgoing messages into segments • Reassembles messages

TCP • Connection-oriented • Reliable • Divides outgoing messages into segments • Reassembles messages in the destination station • Re-sends anything not received • Reassembles messages from incoming segments

Comparison of IP & TCP IP TCP • Layer 3 Protocol • Layer 4

Comparison of IP & TCP IP TCP • Layer 3 Protocol • Layer 4 Protocol • Connectionless • Connection-oriented • Best Effort Delivery • Flow Control & Reliability

Port Numbers • Both TCP and UDP use port (or socket) numbers to pass

Port Numbers • Both TCP and UDP use port (or socket) numbers to pass information to the upper layers • Port numbers are used to keep track of different conversations that cross the network at the same time. Port Numbers Assigned to Below 255 Public Applications 255 - 1023 Companies, marketable apps Above 1023 Unregulated

Port Numbers • End systems use port numbers to select the proper application. •

Port Numbers • End systems use port numbers to select the proper application. • Originating source port numbers, usually some numbers larger than 1023, are dynamically assigned by the source host Telnet Server Networking Cloud Client Frame Segment Header Source Destination Port 1028 25

TCP Segment Format 0 4 10 16 Source Port Number 24 31

TCP Segment Format 0 4 10 16 Source Port Number 24 31

TCP Segment Format 0 4 10 Source Port 16 24 Destination Port Number 31

TCP Segment Format 0 4 10 Source Port 16 24 Destination Port Number 31

TCP Segment Format 0 4 10 Source Port 16 24 Destination Port Sequence Number

TCP Segment Format 0 4 10 Source Port 16 24 Destination Port Sequence Number used to ensure correct sequencing of arriving data 31

TCP Segment Format 0 4 10 Source Port 16 24 Destination Port Sequence Number

TCP Segment Format 0 4 10 Source Port 16 24 Destination Port Sequence Number Acknowledgement Number Next expected TCP octet 31

TCP Segment Format 0 4 10 Source Port 16 24 Destination Port Sequence Number

TCP Segment Format 0 4 10 Source Port 16 24 Destination Port Sequence Number Acknowledgement Number HLEN Number of 32 bit words in the header 31

TCP Segment Format 0 4 10 16 Source Port 24 Destination Port Sequence Number

TCP Segment Format 0 4 10 16 Source Port 24 Destination Port Sequence Number Acknowledgement Number HLEN Reserved Set to Zero 31

TCP Segment Format 0 4 10 Source Port 16 24 Destination Port Sequence Number

TCP Segment Format 0 4 10 Source Port 16 24 Destination Port Sequence Number Acknowledgement Number HLEN Reserved Code Bits Control functions (such as set up and termination of a session) 31

TCP Segment Format 0 4 10 Source Port 16 24 Destination Port Sequence Number

TCP Segment Format 0 4 10 Source Port 16 24 Destination Port Sequence Number Acknowledgement Number Window HLEN Reserved Code Bits Number of octets that the sender is willing to accept 31

TCP Segment Format 0 4 10 Source Port 16 24 Destination Port Sequence Number

TCP Segment Format 0 4 10 Source Port 16 24 Destination Port Sequence Number Acknowledgement Number Window HLEN Reserved Code Bits Checksum Calculated checksum of the header and data fields 31

TCP Segment Format 0 4 10 Source Port 16 24 Destination Port Sequence Number

TCP Segment Format 0 4 10 Source Port 16 24 Destination Port Sequence Number Acknowledgement Number Window HLEN Reserved Code Bits Checksum Urgent Pointer Indicates the end of urgent data 31

TCP Segment Format 0 4 10 Source Port 16 24 Destination Port Sequence Number

TCP Segment Format 0 4 10 Source Port 16 24 Destination Port Sequence Number Acknowledgement Number Window HLEN Reserved Code Bits Checksum Urgent Pointer Options (if any) For example option one is maximum TCP segment size 31

TCP Segment Format 0 4 10 Source Port 16 24 31 Destination Port Sequence

TCP Segment Format 0 4 10 Source Port 16 24 31 Destination Port Sequence Number Acknowledgement Number Window HLEN Reserved Code Bits Checksum Urgent Pointer Options (if any) Padding Additional (redundant) bits to complete the header

TCP Segment Format 0 4 10 Source Port 16 24 Destination Port Sequence Number

TCP Segment Format 0 4 10 Source Port 16 24 Destination Port Sequence Number Acknowledgement Number Window HLEN Reserved Code Bits Checksum Urgent Pointer Options (if any) Padding Data …………. Upper layer protocol data 31

Sample Protocols using TCP/IP Application FTP HTTP 21 SMTP 80 25 Transport TCP Internet

Sample Protocols using TCP/IP Application FTP HTTP 21 SMTP 80 25 Transport TCP Internet IP Network Interface Internet Your LAN DNS 53 Many LANs & WANs

UDP • Connectionless • Unreliable • Transmits messages called user datagrams • No software

UDP • Connectionless • Unreliable • Transmits messages called user datagrams • No software checking for message delivery • Does not reassemble incoming messages • Use no acknowledgements • No flow control

UDP Segment Format 0 16 Source Port Number 31

UDP Segment Format 0 16 Source Port Number 31

UDP Segment Format 0 16 Source Port 31 Destination Port Number

UDP Segment Format 0 16 Source Port 31 Destination Port Number

UDP Segment Format 0 16 Source Port 31 Destination Port Length of UDP header

UDP Segment Format 0 16 Source Port 31 Destination Port Length of UDP header & data in bytes

UDP Segment Format 0 16 31 Source Port Destination Port Length Checksum Calculated checksum

UDP Segment Format 0 16 31 Source Port Destination Port Length Checksum Calculated checksum of the header & data fields

UDP Segment Format 0 16 31 Source Port Destination Port Length Checksum DATA ………

UDP Segment Format 0 16 31 Source Port Destination Port Length Checksum DATA ……… Upper layer protocol data

Sample Protocols using UDP TCP/IP Application TFTP SNMP 69 DHCP 161 67 Transport UDP

Sample Protocols using UDP TCP/IP Application TFTP SNMP 69 DHCP 161 67 Transport UDP Internet IP Network Interface Internet Your LAN DNS 53 Many LANs & WANs

TCP 3 -way Handshake/Open Connection • A three-way handshake/open connection sequence synchronizes a connection

TCP 3 -way Handshake/Open Connection • A three-way handshake/open connection sequence synchronizes a connection at both ends before data is transferred. • This process ensures that any data that is lost due to transmission problems can be recovered

TCP 3 -way Handshake/Open Connection 1 a. HOST A initiates a connection by sending

TCP 3 -way Handshake/Open Connection 1 a. HOST A initiates a connection by sending a packet indicating its initial sequence number of X 1 b. HOST B receives the packet, records the sequence number of X 2 a. HOST B replies with an ACK of X+1 and includes its own Seq. # of Y 2 b. HOST A receives the packet, records the Seq # of Y 3 a. HOST A sends the ACK number of Y+1 3 b. HOST B receives the ACK number of Y+1 HOST A HOST B 1 a. Send SYN (Seq=X) 1 b. Receive SYN (Seq=X) 2 b. Receive SYN (Seq=Y, ACK=X+1) 2 a. Send SYN (Seq=Y, ACK=X+1) 3 a. Send ACK (ACK=Y+1) 3 b. Receive ACK (ACK=Y+1)

TCP Simple Acknowledgement Window Size = 1 HOST A Send 1 Send ACK =

TCP Simple Acknowledgement Window Size = 1 HOST A Send 1 Send ACK = 2 Receive ACK=2 Send 2 HOST B Receive 1 Receive 2 Send ACK = 3 Receive ACK=3 Send 3 Receive 3 Send ACK = 4 Receive ACK=4

TCP Sliding Window Size = 3 HOST A Send 1, 2, 3 Send ACK

TCP Sliding Window Size = 3 HOST A Send 1, 2, 3 Send ACK = 4 Receive ACK=4 HOST B Receive 1, 2, 3 Send 4, 5, 6 Receive 4, 5, 6 Send ACK = 7 Receive ACK=7 Send 7, 8, 9 Receive 7, 8, 9 Send ACK =10 Receive ACK=10