Download presentation
Presentation is loading. Please wait.
Published byBerniece Singleton Modified over 8 years ago
3
Two Transport Protocols Available Transmission Control Protocol (TCP) User Datagram Protocol (UDP) Provides unreliable transfer Requires minimal – Overhead – Computation – Communication Each message encapsulated in IP datagram
4
UDP User Datagram Protocol
5
Connectionless Receiver socket bind on X recvfrom Sender socket sendto Dst/X Sender socket sendto Dst/X Dst internet
6
Protocol Ports Server – Follows standard – Always uses same port number – Uses lower port numbers Client – Obtains unused port from protocol software – Uses higher port numbers
7
Data Encapsulation
10
Protocol Port Example Domain name server application is assigned port 53 Application using DNS obtains port 28900 UDP datagram sent from application to DNS server has – Source port number 28900 – Destination port number 53 When DNS server replies, UDP datagram has – Source port number 53 – Destination port number 28900
11
UDP checksum 015 1631 checksum data(if any) source portdestination port UDP length source IP address destination IP address zeroprotocolUDP length pad (0) UDP pseudo header UDP header
12
Example DHCP server DHCP client A: reboot DHCP client B: winipcfg
13
TCP Transmission Control Protocol
14
TCP Transmission Control Protocol RFC-793 Connection-oriented Reliable Byte stream Dispatch data to socket
15
Connection-Oriented Receiver socket bind on X listen accept recv Sender socket bind connect Dst/X send Dst internet
16
Reliable Packet Checksum Sequence number Ack number Timeout Re-transmission
17
Relationship Between TCP And Other Protocols TCP on one computer uses IP to communicate with TCP on another computer IP offers best-effort (unreliable) delivery TCP uses IP TCP provides completely reliable transfer
18
Packet Format source portdestination port sequence number acknowledgement number window size checksumurgent pointer header len reser URGURG ACKACK PSHPSH RSTRST SYNSYN FINFIN 015 1631
19
Packet format SYN : synchronize sequence numbers to initiate a connection URG : urgent pointer is valid ACK : ack number is valid PSH : receiver should pass this data to application ASAP RST : reset the connection FIN : finish sending data
20
Reliable Data Transmission Positive acknowledgment – Receiver returns short message when data arrives – Called acknowledgment Retransmission – Sender starts timer whenever message is transmitted – If timer expires before acknowledgment arrives, sender retransmits message
21
Illustration Of Retransmission
22
How Long Should TCP Wait Before Retransmitting? Time for acknowledgment to arrive depends on – Distance to destination – Current traffic conditions Multiple connections can be open simultaneously Traffic conditions change rapidly Solving The Retransmission Problem Keep estimate of round trip time on each connection Use current estimate to set retransmission timer Known as adaptive retransmission Key to TCP’s success
23
Illustration Of Adaptive Retransmission Timeout depends on current round-trip estimate
24
Illustration Of Window Advertisement
25
For protecting the misdelivery by IP, except to the entire segment, the checksum calculation need to plus the pseudoheader it calculates the 16-bit one’s complement addition of all 16-bit words in the pseudoheaer, TCP header, and TCP segment body Two options for the TCP –Window scale factor: windows field is multiplied by a 2 F, F <=14 –Timestamp: for deriving the round-trip time Checksum
26
Uses 3-way handshake to establish connection SYN used for startup Connection Establish SYN 141223, win 4096 SYN 254242, win 4096 ack 141224 ack 254243, win 4096 MSS: max segment size SYN_SENT SYN_RCVD ESTABLISH CLOSED
27
Uses modified 3-way handshake to establish connection FIN used for shutdown Connection Termination FIN 341248 ack 668451 FIN 668451 ack 341249 ack 668452 ack 341249 FIN_WAIT_1 CLOSE_WAIT FIN_WAIT_2 TIME_WAIT LAST_ACK CLOSED ESTABLISH CLOSED
28
TCP State Machine CLOSED LISTEN ESTABLISHED CLOSING TIME_WAIT SYN_RCVDSYN_SENT CLOSE_WAIT LAST_ACK FIN_WAIT_1 FIN_WAIT_2 active OPEN snd SYN recv SYN, ACK snd ACK recv FIN snd ACK recv ACK AP Close snd FIN passive OPEN AP Close snd FIN recv SYN snd ACK, SYN recv ACK recv FIN snd ACK recv ACK Timeout=2MSL recv ACK recv FIN snd ACK AP Close snd FIN recv FIN,ACK snd ACK AP Close or timeout
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.