Presentation is loading. Please wait.

Presentation is loading. Please wait.

3. END-TO-END PROTOCOLS (PART 1) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic University 22 March 2016 1.

Similar presentations


Presentation on theme: "3. END-TO-END PROTOCOLS (PART 1) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic University 22 March 2016 1."— Presentation transcript:

1 3. END-TO-END PROTOCOLS (PART 1) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic University 22 March 2016 1

2 2 Problem: How to extend the host-to-host packet delivery service to a process-to-process communication channel? Best-effort service provided by IP: 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 1. The transport problem

3 3 Expectations from transport layer 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 between the sender and receiver allow the receiver to apply flow control to the sender support multiple application processes on each host

4 4 2. Types of transport protocols Different transport protocols provide different sets of services: User Datagram Protocol (UDP): Mainly provide a demultiplexing service. Transmission Control Protocol (TCP): Provide a reliable byte-stream service Remote Procedure Call (RPC): Provide services to transaction- based applications. Real Time Protocol (RTP): Provide services for transporting real-time data over UDP.

5 5 3. UDP (RFC 768) UDP adds a demultiplexing service to IP. UDP optionally provides error detection but it becomes mandatory for UDP over IPv6. UDP provides the demultiplexing service through UDP ports. The idea is for a source process to send a message to a port and for a destination process to receive the message from a port. Process IDs can also be used if all systems run on the same OS.

6 6 3. UDP (RFC 768) A process is uniquely identified by (Port number, IP address), which is usually referred to as a socket. A port is usually implemented by a message queue. How does a process learn the port for the other party? For a server process, it will know the client’s port whenever the client gets connected. For a client process, one approach to learn server’s port is through the well-known port.

7 7 3.1 UDP message queues Application process Application process Application process UDP Packets arrive Ports Queues Packets demultiplexed

8 8 3.2 UDP packet UDP header format When a sender computes the optional checksum, a pseudo- header is first prepended to the UDP header. Why?

9 9 4. TCP (RFC 793) TCP uses connection as its fundamental abstraction. A TCP connection is specified by a pair of sockets, each of which identifies an endpoint, i.e. Unlike UDP, TCP requires both endpoints to agree to connect. TCP provides a connection-oriented, reliable, byte stream service to the upper layer. Need to obtain an explicit agreement from the other side before sending data.

10 10 4. TCP (RFC 793) The TCP sender provides a reliable service using a sliding window mechanism, positive acknowledgment, and retransmission. TCP considers the data passed from applications as streams of bytes. Each byte is therefore identified by a number. A TCP receiver does not understand the relationship among bytes. TCP supports full-duplex connections. TCP also provides congestion control and flow control services.

11 11 4. TCP (RFC 793) Application process Write bytes TCP Send buffer Segment Transmit segments Application process Read bytes TCP Receive buffer … ……

12 12 4.1 End-to-end issues Sliding Window Protocol in TCP 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 amounts of buffering Potentially different network capacity need to be prepared for network congestion

13 13 4.2 TCP connection establishment TCP connection setup is asymmetric. The one initiates the connection does an active open. The other end does a passive open. It involves a total of three special TCP messages (SYN segments): A three-way handshaking (1.5 round-trip time). Connection establishment timeout TCP client resends a SYN segment with exponential backoff up to a certain time.

14 14 4.2 TCP connection establishment Information exchange during connection establishment: Initial Sequence Numbers (ISN), which are the first SNs used by the two sides. The SYN segment also advertises window size (buffer available for receiving data). Each side may optionally announce the Maximum Segment Size (MSS) it expects to receive. If the destination IP address is local, set MSS to the local network’s MTU  40 bytes. Otherwise, usually set MSS to 536 bytes.

15 15 4.3 An example Client Server SYN, SequenceNum = x SYN + ACK, SequenceNum = y, ACK, Acknowledgment = y + 1 Acknowledgment = x + 1

16 16 4.4 TCP connection termination TCP connection termination is symmetric: Each side has to close the connection independently. At most four FIN segments are needed. By closing the connection, it means that no more data will be sent, but can still receive data. A connection in the TIME_WAIT state cannot move to the CLOSED state until it has waited for 2  Maximum Segment Lifetime (MSL). Reasons for this?

17 17 4.5 An example Client Server FIN, SequenceNum = x ACK x + 1 FIN, SequenceNum = y ACK y + 1 close() FIN_WAIT_1 FIN_WAIT_2 TIME_WAIT CLOSE_WAIT close() LAST_ACK CLOSED

18 18 4.6 TCP state transition diagram CLOSED LISTEN SYN_RCVDSYN_SENT ESTABLISHED CLOSE_WAIT LAST_ACKCLOSING TIME_WAIT FIN_WAIT_2 FIN_WAIT_1 Passive openClose Send/SYN SYN/SYN + ACK SYN + ACK/ACK SYN/SYN + ACK ACK Close/FIN FIN/ACKClose/FIN FIN/ACK ACK + FIN/ACK Timeout after two segment lifetimes FIN/ACK ACK Close/FIN Close CLOSED Active open/SYN

19 19 4.7 TCP segments

20 20 4.7 TCP segments Data field is optional. SN, AN, and window size are all involved in the sliding window algorithm. SN refers to the number of the first data byte. The TCP header is not of fixed length due to the options (MSS, timestamp, window scale, etc). The checksum covers the header and the payload, i.e., end-to-end checksum. A pseudo-header is first prepended to the TCP header before computing the checksum.

21 21 4.7 TCP segments Both urgent pointer and PUSH can be used to serve as a signal to the receiver about the “record boundary.” The receiving process needs to be notified when the URG bit or PUSH bit is set. These mechanisms serve as end-of-record markers. The PUSH bit can also be used to allow the sending process to send whatever bytes in the buffer (for interactive applications).


Download ppt "3. END-TO-END PROTOCOLS (PART 1) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic University 22 March 2016 1."

Similar presentations


Ads by Google