Presentation is loading. Please wait.

Presentation is loading. Please wait.

Transport Layer3-1 Chapter 3 outline r 3.1 Transport-layer services r 3.2 Multiplexing and demultiplexing r 3.3 Connectionless transport: UDP r 3.4 Principles.

Similar presentations


Presentation on theme: "Transport Layer3-1 Chapter 3 outline r 3.1 Transport-layer services r 3.2 Multiplexing and demultiplexing r 3.3 Connectionless transport: UDP r 3.4 Principles."— Presentation transcript:

1 Transport Layer3-1 Chapter 3 outline r 3.1 Transport-layer services r 3.2 Multiplexing and demultiplexing r 3.3 Connectionless transport: UDP r 3.4 Principles of reliable data transfer r 3.5 Connection-oriented transport: TCP m Service characteristics m segment structure m Connection management m flow control r 3.6 Principles of congestion control r 3.7 TCP congestion control

2 Transport Layer3-2 TCP service characteristics r End-to-end reliable service m guarantee the reliable data transfer between application processes r connection-oriented service r full duplex transmission m Data can flow in both direction at the same time. r stream-oriented transmission m TCP views messages from application processes as continuous byte stream, not as separate packets. r Graceful connection release m When the connection terminates, TCP releases the connection after data transfer is completed.

3 Transport Layer3-3 How to provide reliable services(1) r Transmission unit is segment. m The data from application processes are fragmented to have the size proper for transmission. Each fragmented data is called a segment. m On the contrary, UDP does not fragment the application data, instead send the data as it was given from application processes. r Management of the segment sequence m Each segment is given a sequence number (viewed as byte streams), so receiver TCP can recognize any loss of segments and the out-of-sequence of arriving segments.

4 Transport Layer3-4 How to provide reliable services(2) r ACK transmission m When TCP receives correct segments, it always replies with ACK segment. m For enhancing performance, it uses the accumulative ACK. r Timer management m When TCP sends segments, it starts a timer. When the ACK for the segments sent does not arrive until the timer times out, it resends the same segment.

5 Transport Layer3-5 How to provide reliable services(3) r Error control (checksum) m TCP checks any error on the segments it received using the checksum field in the header. If it finds any error, it discards the segment. m Also using the sequence number on the segment, it checks any loss of segments or out-of-sequence of the segments. r Order control m The receiver stores the packets it receives in the buffer, and after keeping the order of segments, it delivers them to application processes. r Detection and discard of duplicate segments m When the same segments arrives, the receiver discards one of them.

6 Transport Layer3-6 How to provide reliable services(4) r Clear connection management m When one end station happens to reboot, the station will setup another TCP connection in addition to the current TCP connection. In this case, TCP can distinguish the segments of the previous connection and the newly established connection. r Flow control m TCP uses a buffer, and notifies the other TCP on the connection of the available space in the buffer for receiving. So the other TCP can send only the amount of segments and stop. r Congestion control m TCP controls transmission rate depending on congestion state in the network.

7 Transport Layer3-7 Stream-oriented transmission r TCP views messages from application processes as continuous byte stream, not as separate packets.

8 Transport Layer3-8 Sending and Receiving Buffers r Data from the application process is stored in the sending buffer. r Then TCP groups a number of bytes together into a segment.

9 Transport Layer3-9 Chapter 3 outline r 3.1 Transport-layer services r 3.2 Multiplexing and demultiplexing r 3.3 Connectionless transport: UDP r 3.4 Principles of reliable data transfer r 3.5 Connection-oriented transport: TCP m Service characteristics m segment structure m connection management m flow control r 3.6 Principles of congestion control r 3.7 TCP congestion control

10 Transport Layer3-10 TCP Segment TCP headerTCP data IP datagram(packet) TCP segment 20 octets IP header

11 Transport Layer3-11 TCP Header

12 Transport Layer3-12 Sequence Number r Segment number identifies the byte in the stream of data from the sending TCP to the receiving TCP that the first byte of data in the segment represents. r The number does not necessarily start from 0. r The unit is not segments, but bytes.. r The size is 2 32 that is large enough to detect duplicate segments.

13 Transport Layer3-13 Application process TCP [seq=300, data] [seq=500, data] [seq=650, data] SEND (200 byte data) SEND (100 byte data) SEND (150 byte data)

14 Transport Layer3-14 Example 1 Imagine a TCP connection is transferring a file of 6000 bytes. The first byte is numbered 10010. What are the sequence numbers for each segment if data are sent in five segments with the first four segments carrying 1000 bytes and the last segment carrying 2000 bytes? Solution The following shows the sequence number for each segment: Segment 1 ==> sequence number: 10,010 (range: 10,010 to 11,009) Segment 2 ==> sequence number: 11,010 (range: 11,010 to 12,009) Segment 3 ==> sequence number: 12,010 (range: 12,010 to 13,009) Segment 4 ==> sequence number: 13,010 (range: 13,010 to 14,009) Segment 5 ==> sequence number: 14,010 (range: 14,010 to 16,009)

15 Transport Layer3-15 Acknowledge Number r Accumulative ACK Sender TCPReceiver TCP [seq=1000, 100 byte data] [seq=1100, 200 byte data] [seq=1300, 100 byte data] [ACK=1400] By convention, the ACK number is the byte number of the segment that the receiver expects to receive next time.

16 Transport Layer3-16 Window Size r TCP flow control m This field is used for TCP flow control (often called “Credit technique”). m It is used for a receiver to notify a sender of the size of empty space in the receiver TCP buffer. m The unit is byte. m If the buffer size is larger than 2 16, it can be extended using the option field. m Its use is independent of the use of the acknowledge number field that says the success or failure of the segment transmission.

17 Transport Layer3-17 TCP Control Field

18 Transport Layer3-18 Pushing Data(1) r When an application process sends a stream of data to the sending TCP, TCP stores data in the buffer and then makes segments at an appropriate time. r The receiving TCP also store the receiving data in its buffer, and then sends data to an application process when it is convenient.

19 Transport Layer3-19 Pushing Data(2) r In some application such as interactive application, this kinds of TCP operation causes some problem r To avoid this situation, the sending application process request a push operation which means the sending TCP should not wait for the window to be filled. r The receiving TCP also sends the data immediately to the application process without any delay when the PUSH bit is set in the segment.

20 Transport Layer3-20 Urgent Data r The sending application process tells the sending TCP that some data is urgent, so should be delivered immediately. Then the sending TCP sets URG bit and appends the urgent data and its location in the payload of the segment is pointed by the urgent pointer r The receiving TCP sends the urgent data to the application process immediately when it sees the URG bit in the segment it receives.

21 Transport Layer3-21 Chapter 3 outline r 3.1 Transport-layer services r 3.2 Multiplexing and demultiplexing r 3.3 Connectionless transport: UDP r 3.4 Principles of reliable data transfer r 3.5 Connection-oriented transport: TCP m Service characteristics m segment structure m connection management m flow control r 3.6 Principles of congestion control r 3.7 TCP congestion control

22 Transport Layer3-22 TCP Connection Establishment r Three-way handshake r The client(sender) sends the first segment: a SYN segment. m It contains the initialization sequence number. r The server sends the second segment, a SYN and ACK segment. m It acknowledges the receipt of the first segment. m It contains the initialization sequence number. m The server must also define the client window size. r The client sends the third segment, ACK segment. m It acknowledges the receipt of the second segment. m The client must define the server window size.

23 Transport Layer3-23

24 Transport Layer3-24 TCP Connection Termination r Any of two parties can close the connection. r Graceful connection release m When connection in one direction is terminated, the other part can continue send data in other direction. r One host sends a FIN segment. r The other host sends an ACK segment.

25 Transport Layer3-25

26 Transport Layer3-26 Connection Resetting r TCP may request the resetting of a connection. m Resetting means that the current connection is destroyed. r For resetting, one host sends a segment with the RST bit set.

27 Transport Layer3-27 Chapter 3 outline r 3.1 Transport-layer services r 3.2 Multiplexing and demultiplexing r 3.3 Connectionless transport: UDP r 3.4 Principles of reliable data transfer r 3.5 Connection-oriented transport: TCP m Service characteristics m segment structure m connection management m flow control r 3.6 Principles of congestion control r 3.7 TCP congestion control

28 Transport Layer3-28 TCP Flow Control r receive side of TCP connection has a receive buffer: r speed-matching service: matching the send rate to the receiving app’s drain rate r app process may be slow at reading from buffer sender won’t overflow receiver’s buffer by transmitting too much, too fast flow control

29 Transport Layer3-29 TCP Flow control: how it works (Suppose TCP receiver discards out-of-order segments)  spare room in buffer = RcvWindow = RcvBuffer-[LastByteRcvd - LastByteRead]  Rcvr advertises spare room by including value of RcvWindow in segments  Sender limits unACKed data to RcvWindow m guarantees receive buffer doesn’t overflow

30 Transport Layer3-30 ACK is not enough! 01230123 01230123 01230123 01230123 01230123 01230123 Window 가 닫힘 ACK(3) ACK 안보냄 01230123 Window 가 닫힘 01230123 I(2) I(0) I(1) TIMEOUT I(0) I(3) I(1) I(0) I(3) I(1) I(3),I(0),I(1) 재전송 Window 가 닫힘, BUSY CONDITION 네트워크 상황 및 수신부 상황 더 악화 012012 301301 Max. window size = 3 buffer

31 Transport Layer3-31 Window size advertisement 01230123 01230123 01230123 01230123 01230123 01230123 Window 가 닫힘 ACK 3, Wsize 3 I(2) TIMEER 중지 I(0) I(3) I(1) I(3),I(0),I(1) 재전송 안함 01230123 01230123 Window 가 닫힘, BUSY CONDITION IDLE CONDITION ACK 2, Wsize 0 ACK 2, Wsize 2 01230123 Window 가 닫힘 01230123 Window 가 열림 I(0) I(1) I(2) I(3) 012012 301301 1 Max. window size = 3 buffer

32 Transport Layer3-32 Transport Entity ATransport Entity B....1000100124002401... A may send 1400 octets....10001001....10001001....16001601....16001601.…26002601 2401... 1601 2001 26002601…. 40004001.… 2601…. A shrinks its transmit window with each transmission A adjusts its window with each credit A exhausts its credit A receive new credit....1000100124002401.......1600 1601 2601….....160016012001 2601…..…2600260140004001.… B is prepared receive 1400 octets, beginning with 1001 B acknowledges 3 segments (600 octets) but is only B acknowledges 5 segments (1000 octets) and through 2600 original budget (I.e., B will accept octets 1601 prepared to receive 200 additional octets beyond the restore the original amount of credit SN = 1001 SN = 1401 A = 1601, W = 1000 SN = 1601 SN = 2001 A = 2601, W = 1400 SN = 1201 SN = 1601 SN = 1801 SN = 2201 SN = 2401 Example

33 Transport Layer3-33 Chapter 3 outline r 3.1 Transport-layer services r 3.2 Multiplexing and demultiplexing r 3.3 Connectionless transport: UDP r 3.4 Principles of reliable data transfer r 3.5 Connection-oriented transport: TCP m Service characteristics m segment structure m connection management m flow control m Round-trip time estimation r 3.6 Principles of congestion control r 3.7 TCP congestion control

34 Transport Layer3-34 TCP Round Trip Time and Timeout EstimatedRTT = (1-  )*EstimatedRTT +  *SampleRTT r Exponential weighted moving average r influence of past sample decreases exponentially fast  typical value:  = 0.125

35 Transport Layer3-35 Example RTT estimation:

36 Transport Layer3-36 TCP Round Trip Time and Timeout Setting the timeout  EstimtedRTT plus “safety margin”  large variation in EstimatedRTT -> larger safety margin r first estimate of how much SampleRTT deviates from EstimatedRTT: TimeoutInterval = EstimatedRTT + 4*DevRTT DevRTT = (1-  )*DevRTT +  *|SampleRTT-EstimatedRTT| (typically,  = 0.25) Then set timeout interval:


Download ppt "Transport Layer3-1 Chapter 3 outline r 3.1 Transport-layer services r 3.2 Multiplexing and demultiplexing r 3.3 Connectionless transport: UDP r 3.4 Principles."

Similar presentations


Ads by Google