1 / 77

End-to-End Protocols

Understand the differences between UDP and TCP, the two major transport protocols in the internet, and their functionality for reliable message delivery and flow control.

viviennet
Download Presentation

End-to-End Protocols

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. End-to-End Protocols User Datagram Protocol (UDP) Transmission Control Protocol(TCP)

  2. Underlying Best-Effort Network • Drops messages • Re-orders messages • Delivers duplicate copies of a given message • Limits messages to some finite size • Delivers messages after an arbitrarily long delay

  3. Common End-to-End Services • Guarantee message delivery • Deliver messages in the same order they are sent • Deliver at most one copy of each message • Support arbitrarily large messages • Support synchronization • Allow the receiver to flow control the sender • Support multiple application processes on each host

  4. Transport Protocol • All end-to-end services provided by transport protocol • Separate layer of protocol stack • Conceptually between • Applications layer • IP layer

  5. Terminology • IP • Provides computer-to-computer (or node to node) communication in two different networks • Source and destination addresses are computers • Called machine-to-machine • Transport protocols • Provide application-to-application communication • Need extended addressing mechanism to identify applications (port numbers) • Called end-to-end

  6. Transport Protocol Functionality • Identify sending and receiving applications (by using port numbers) • Optionally provide • Reliability • Flow control • Congestion control • Note: not all transport protocols provide above facilities

  7. Two Transport Protocols Available • Transmission Control Protocol (TCP) • User Datagram Protocol (UDP) • Major differences • Interface to applications • Functionality

  8. User Datagram Protocol (UDP) • Provides unreliable transfer • Requires minimal • Overhead • Computation • Communication • Best for LAN applications (because LAN is a very reliable environment) • Used to support audio/video streaming applications or similar applications that does not require absolute reliability

  9. UDP Details • Connectionless service paradigm • Message-oriented interface • Each message encapsulated in IP datagram • UDP header identifies • Sending application • Receiving application

  10. UDP Detail (cont’d) • Included in TCP/IP suite • Supports many protocol ports • Transports a message from one machine to another • Does not use acknowledgements • Does not order incoming messages • Does not do flow control • Application program is responsible to handle all problems such as loss, duplication, delay, out of order delivery, etc.

  11. Simple Demultiplexor (UDP) 0 16 31 SrcPort DstPort • Adds multiplexing • No flow control • Endpoints identified by ports • servers have well-known ports • see /etc/services on Unix • Header format • Optional checksum • pseudo header + UDP header + data • Source port is optional (zero, if not used) • Length includes all fields (Minimum value is 8) Length Checksum Data

  12. UDP Checksum • Optional: checksum can be used to verify delivery of datagram to a correction destination • Pseudoheader • Consists of three fields from IP header: protocol number, source IP address, and destination IP addressplus the UDP length field • UDP uses the same checksum algorithm as IP • Note: UDP length is included twice in the calculation

  13. UDP Pseudo-Header • Used to verify that UDP has reached its destination • Used during UDP checksum computation

  14. UDP Protocol Layering • Operates in the same layer as TCP Application Transport Internet Network Interface Physical

  15. UDP Encapsulation • Entire UDP message is encapsulated in an IP datagram UDP-Hdr Data Area IP-Hdr IP Data Area Frame-Hdr Frame Data Area

  16. Note: The IP layer is responsible only for transferring data between a pair of hosts on an internet, while UDP layer is responsible only for differentiating among multiple sources or destinations within one host.

  17. UDP Message Queue Application Application Application process process process Ports Queues Packets demultiplexed UDP Packets arrive

  18. Identifying An Application • Cannot extend IP address: No unused bits • Cannot use OS-dependent quantity: Process ID, task number or Job name • Must work on all computer systems • Invent new abstraction • Used only with TCP/IP • Identifies sender and receiver unambiguously • Technique • Each application assigned unique integer • Called protocol port number

  19. 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

  20. 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

  21. Common Port Assignments

  22. Transmission Control Protocol (TCP) • Major transport protocol used in Internet • Heavily used • Completely reliable transfer

  23. TCP Features • Connection-oriented service • Point-to-point • Full-duplex communication • Stream interface • Stream divided into segments for transmission • Each segment encapsulated in IP datagram • Uses protocol ports to identify applications

  24. Application process Application process W rite Read bytes bytes … … TCP TCP Send buffer Receive buffer … Segment Segment Segment T ransmit segments TCP Overview • Full duplex • Flow control: keep sender from overrunning receiver • Congestion control: keep sender from overrunning network • Connection-oriented • Byte-stream • app writes bytes • TCP sends segments • app reads bytes

  25. TCP Feature Summary TCP provides a completely reliable (no data duplication or loss), connection-oriented, full-duplex stream transport service that allows two application programs to form a connection, send data in either direction, and then terminate the connection.

  26. Data Link Versus Transport • Potentially connects many different hosts • need explicit connection establishment and termination • Potentially different RTT • need adaptive timeout mechanism • Potentially long delay in network • need to be prepared for arrival of very old packets • Potentially different capacity at destination • need to accommodate different node capacity • Potentially different network capacity • need to be prepared for network congestion

  27. Apparent Contradiction • IP offers best-effort (unreliable) delivery • TCP uses IP • TCP provides completely reliable transfer • How is this possible?

  28. Achieving Reliability • Reliable connection startup • Reliable data transmission • Graceful connection shutdown

  29. Reliable Data Transmission • Positive acknowledgement • Receiver returns short message when data arrives • Called acknowledgement • Retransmission • Sender starts timer whenever message is transmitted • If timer expires before acknowledgement arrives, sender retransmits message

  30. How Long Should TCP Wait Before Retransmitting? • Time for acknowledgement to arrive depends on • Distance to destination • Current traffic conditions • Multiple connections can be open simultaneously • Traffic conditions change rapidly

  31. Important Point The delay is required for data to reach a destination and an acknowledgement to return depends on traffic in the internet as well as the distance to the destination. Because it allows multiple application programs to communicate with multiple destinations concurrently, TCP must handle a variety of delays that can change rapidly.

  32. Solving Retransmission Problem • Keep estimate of roundtrip time on each connection • Use current estimate to set retransmission timer • Known as adaptive retransmission • Key to TCP's success

  33. TCP Flow Control • Receiver • Advertises available buffer space • Called window • Sender • Can send up to entire window before ack arrives

  34. Window Advertisement • Each acknowledgement carries new window information • Called window advertisement • Can be zero (called closed window) • Interpretation: I have received up through X, and can take Y more octets

  35. Startup And Shutdown • Connection startup • Must be reliable • Connection shutdown • Must be graceful • Difficult

  36. Why Startup/Shutdown Difficult • Segments can be • Lost • Duplicated • Delayed • Delivered out of order • Either side can crash • Either side can reboot • Need to avoid duplicate "shutdown" message from affecting later connection

  37. TCP's Startup/Shutdown Solution • Uses three-message exchange • Known as 3-way handshake • Necessary and sufficient for • Unambiguous, reliable startup • Unambiguous, graceful shutdown • SYN used for startup • FIN used for shutdown

  38. Connection Establishment and Termination Active participant Passive participant (client) (server) SYN, SequenceNum = x , y 1 + SYN + ACK, SequenceNum = x Acknowledgment = ACK, Acknowledgment = y + 1

  39. Illustration: Closing a connection Host 1 . . Host 2 Send FIN + ACK Receive FIN+ACK Send FIN +ACK Receive FIN+ACK Send ACK Receive ACK

  40. All TCP segments have same format Data Acknowledgement SYN (startup) FIN (shutdown) Segment divided into two parts Header Payload area (zero or more bytes of data) Header contains protocol port numbers to identify sending and receiving applications Bits to specify items such as SYN FIN ACK Fields for window advertisement, acknowledgement, etc. TCP Segment Format

  41. Sequence number specifies where in stream data belongs Acknowledgement fieldspecifies the sequence number of first byte in stream data to be received next (implying all previous bytes received correctly) Few segments contain options TCP Segment Format

  42. Data (SequenceNum) Sender Receiver Acknowledgment + AdvertisedWindow Segment Format (cont) • Each connection identified with 4-tuple: • (SrcPort, SrcIPAddr, DsrPort, DstIPAddr) • Sliding window + flow control • acknowledgment, SequenceNum, AdvertisedWinow • Flags (6 bits) • SYN, FIN, RESET, PUSH, URG, ACK • Checksum • pseudo header + TCP header + data • HdrLen - Header length in 32-bit words

  43. Flag/Code Bits in TCP Segment • 6-bit field • Tells how to interpret other fields in the header • RST bit set to abort the connection during unexpected situation (ex. Arrival of an unexpected segment )

  44. Out of Band Data • Data to be sent immediately • Example: interrupting or aborting the program in a remote login session. • TCP option: specify data as urgent • Set URG code bit • Set the urgent pointer (UrgPtr) specifying where urgent data ends in the segment (Urgent data is contained at the front the segment body) • TCP tells the application to return to normal mode after consumption of urgent data • PUSH flag to tell receiving TCP to notify the receiving process about the PUSH operation

  45. TCP Checksum Computation • TCP prepends a pseudo header to the segment • Appends enough zero bits to make the segment a multiple of 16 bits • Computes 16-bit checksum over the entire result • Uses 16-bit arithmetic • Takes one's complement of the one's complement sum • Notes: • TCP does not count the pseudo header or padding in the segment length • TCP does not transmit the pseudo header or padding • TCP assumes the checksum field itself is zero before computation

  46. Format of Pseudoheader used in TCP computation • PROTOCOL field - for IP datagrams, it is 6 • TCP LENGTH field - total length of TCP segment including TCP header

  47. Purpose of Pseudo Header • To verify the segment has reached its correct destination (Port number & destination IP address) • IP passes the source and destination IP addresses to the receiving TCP from the datagram • Receiving TCP performs the same computation

  48. Timeout and Retransmission • Note:TCP software must accommodate both the vast differences in time required to reach various destinations and the changes in time required to reach a given destination as traffic load varies. • Uses an adaptive retransmission algorithm • Records the time at which each segment is sent • Records the time at which an acknowledgement arrives for the segment • From the two times, it computes a sample round trip time (RTT).

  49. Adaptive Formulas • From the sample RTT and old RTT, it estimates the round-trip time for next segment • Example: RTT = (a * Old_RTT) + ((1 - a)* New_Round_Trip_Sample where, 0 <a< 1 • Calculates a timeout value as a function of the current round trip estimate • Example Timeout = b * RTT where b > 1 (Recommended value for b is 2)

  50. Accurate Measurement Of Round Trip Samples • TCP uses a cumulative acknowledgement • ACK refers to data received but not to the instance of a specific segment • In case of retransmission, both the original and the retransmitted segments carry exactly same data • TCP cannot relate an ACK with the original or the retransmitted segment • The problem is called acknowledgement ambiguity

More Related