Internet Transport Protocols UDP and TCP

Internet Transport Protocols UDP and TCP

Internet Transport Protocols UDP and TCP Dr. T. Znati Computer Science Department Outline Transport Layer Review UDP Protocol UDP Characteristics UDP Functionalities TCP Protocol TCP Characteristics Connection Management TCP Flow and Congestion Control 1 Design Issues TRANSPORT LAYER Transport Layer Services and Protocols Transport layer provides a logical connection between application processes running on different hosts Transport Layer Services Connection Management If connection-oriented Multiplexing and De-Multiplexing Data Segmentation and Reassembly Error, Flow and Congestion Control 2 Transport Layer Concepts Host Host Application Application Logical Connection Transport Transport IP IP Network Network Access Access Physical Physical Router IP Internet NA NA Internet PHY PHY Internet Transport Layer Protocols The IP suite offers two transport protocols User Datagram Protocol (UDP) Connectionless protocol “Best Effort” Service Unreliable Unordered datagram delivery No error or flow control Transmission Control Protocol Connection-oriented protocol Reliable, ordered delivery of byte stream Error, flow and congestion control No delay guarantees and no bandwidth guarantees 3 User Datagram Protocol UDP UDP Characteristics UDP is a connectionless datagram service. No need to establish a connection prior to data transfer Datagrams may be generated and transmitted at any time. UDP datagrams are self-contained. UDP is unreliable: No acknowledgements for reliable delivery of data. Checksums cover the header, and only optionally cover the data. Contains no mechanism to detect missing or out of sequence datagrams. No mechanism for automatic retransmission. No mechanism for flow control Sender can over-run the receiver. 4 UDP Service UDP provides unreliable connectionless delivery service using IP to transport datagrams UDP does not enhance the “best effort” service provided by IP UDP provides “ports” to distinguish among multiple destinations within a host Ports are used to multiplexing and demultiplex applications’ traffic UDP Operation A1 A2 B1 B2 App App App App Socket OS UDP IP UDP uses port number to demultiplex packets 5 User Datagram Protocol UDP Source Port UDP Destination Port UDP Message Length UDP Checksum Data Physical Physical IP Header UDP Header Data Header Trailer IP Datagram Physical Data Frame UDP Checksum UDP source port is optional (set to 0 if not used) UDP checksum is optional (set to 0 if not used) Using UDP checksum option is useful, however, since IP checksum does not cover the data portion of the datagram It provides the only way to ensure that data has arrived intact and should be used Also, the only way to verify the UDP header 6 UDP Checksum The UDP checksum covers more information than is present in the UDP datagram A pseudo-header is prepended to the UDP datagram, and a checksum over the entire object is computed The pseudo-header contains source and destination IP addresses, IP protocol type (code 17 for UDP), and UDP datagram length (the pseudo-header not included) It guarantees that the datagram has reached the proper destination The checksum is computed as a one’s complement sum (sum modulo 216-1) of all 16-bit words of the header and the pseudo-header (checksum field is set to 0) and taking one’s complement of the result Appropriate Uses of UDP Inward data collection Outward data dissemination Request-response Real-time applications Streaming of real-time audio and video. On-time delivery is important Minimum overhead 7 Transmission Control Protocol TCP Transmission Control Protocol TCP provides a reliable virtual circuit service TCP guarantees ordered delivery of a stream of data without loss or duplicatio, despite unreliable network packet delivery service TCP assumes little about the underlying communication system TCP can be used with a variety of packet delivery services Dial-up telephone lines Local and wide area networks Low and high-speed long haul networks 8 TCP Interface Characteristics Virtual Circuit connection TCP is full-duplex TCP is stream-oriented protocol Data is viewed as a stream of bytes TCP provides an unstructured stream TCP does not mark boundaries between streams Application’s responsibility to understand stream contents Buffered transfer TCP collects enough data to fill a reasonably large datagram before transmission TCP provides a push mechanism to force transfer, if needed TCP supports a “stream of bytes” service Sender Receiver 9 Stream Service is emulated using TCP “Segments” Sender Segment sent when: TCP Data Segment is full MSS bytes, Segment not full, but times out, or “Pushed” by application. TCP Data MSS = Maximum Segment Size Receiver TCP MSS TCP segments are the messages that carry data between TCP sender and receiver TCP must decide how many bytes to put into each message that it sends. The current size of a TCP segment, CSS, is determined by two factors W – The size of the receiver’s window (bytes) Maximum Segment Size (MSS) – A ceiling on TCP segment size, never to be exceeded CSS = minimum(MSS, W) 10 TCP Interface Characteristics TCP specifications describe generally how applications use TCP, but do not dictate details of an interface There have been numerous implementations of TCP TCP Reno, TCP Tahoe, TCP Las Vegas, SACK TCP, …. Connection Establishment – Three-way Handshake Passive Server Client Listening for Connection Send data unit Requests with SYN bit set SYN x and seq# = x Receive data unit Send data unit with SYN bit set ACK x+1/SYN y and seq# = y, Receive data unit acknowledge x+1 Send data unit acknowledge y+1 ACK y+1 Receive data unit 11 Connection Termination TCP connections are terminated with “graceful close” Graceful close ensures that the connection is terminated after all data had been received One side issues Close request, and is not permitted to transmit data after sending it The other side acknowledges it, but can send data until it sends Close request too After the second Close request is acknowledged, the connection is closed Connection Termination No data transmission FIN x from this side Last segment sent by receiver • Sequence number : y ACK x+1/ Data y • Length: k ACK y+k+1 FIN y+k ACK y+k+1 12 TCP Segment Format 0 15 31 Source Port Destination Port Sequence Number Acknowledgement Number Data U A P R S F Reserved R C S S Y I Window Offset G K H T N N Checksum Urgent pointer Options Padding Data TCP Segment Fields Source and Destination Port Number 16-bit – end-point identifiers Sequence Number 32-bit – number of the first data octet in this segment except for when the SYN flag is set When the SYN flag is set, sequence number identifies “the Initial Sequence Number” and the first data octet is ISN+1 Acknowledgement Number 32-bit – number of the next octet expected to receive Data Offset 4-bit – number of 32-bit words in the header (including options) Header Length 13 TCP Flags URG: segment contains urgent data: urgent pointer points to the last octet of urgent data ACK: acknowledgement field is significant PSH: segment is sent with the push function RST: reset the connection Closes a half-open connection SYN: synchronize sequence numbers Used during open request FIN: no more data from sender Used during close request TCP Segment Fields Window – 16-bit number of unacknowledged octets that the sender is allowed to transmit Maximum value limits the value of the window size to 216 , unless “window scale” option is used Checksum – 16-bit one’s complement of a one’s complement sum of all 16-bit words of the segment and a pseudo-header (the checksum field is set to zero) The pseudo-header contains the sender’s and receiver’s IP addresses, the protocol type (code 6 for TCP), and the segment length field) A zero padding is added to the segment to make the segment multiple of 16 bits The pseudo-header and the padding are not transmitted 14 Pseudo-header Source address (32-bits) Destination address (32-bits) 00000000 Protocol TCP segment length 00000110 Out-of-Band Data Out-of-band data is needed to handle abort or program interrupt signals These “signals” should not wait for the octets already in the TCP stream to be transmitted Telnet uses this feature to send “interrupt” commands TCP uses URGENT feature to accomodate out-of-band data 15 Out-of-Band Data Out-of-Band Out-of-Band Data Data User Network User Process Process Send Receive Buffer Buffer Application is required to check on the “Out-of-Band” data stream before processing regular data stream Out-of-Band Data TCP notifies associated application of the beginning and end of urgent mode How TCP informs the application depends on the operation system Urgent data is detected by the URG flag set and retrieved by the urgent pointer Unfortunately, TCP does not denote the beginning of the urgent data in the segment It’s up to the application to decide, where the urgent data starts 16 TCP Options Originally, one option, Maximum Segment Size was defined The 16-bit option may be used only in the initial connection request segment If this option is not used, any segment size is allowed Later, two other options have gained widespread acceptance Window scale factor Timestamps TCP Options End of options Kind = 0 (8 bits) No operation : padding Kind = 1 (8 bits) 17 TCP Options Maximum Segment Size Kind = 2 Length = 4 Maximum Segment Size (8 bits) (8 bits) (16 bits) Window Scale Factor Kind = 3 Length = 3 Shift Count (8 bits) (8 bits) (8 bits) Window Scale

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    53 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us