Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSC 336 Data Communications and Networking Lecture 10: Transport Layer Dr. Cheer-Sun Yang Spring 2001.

Similar presentations


Presentation on theme: "CSC 336 Data Communications and Networking Lecture 10: Transport Layer Dr. Cheer-Sun Yang Spring 2001."— Presentation transcript:

1 CSC 336 Data Communications and Networking Lecture 10: Transport Layer Dr. Cheer-Sun Yang Spring 2001

2 TOPICS OSI Transport Services, design, protocols Example Protocols: TCP, UDP Client-Server Model and Socket Programming

3 Comparison with Data Link Layer Similarity: both layers are focusing on how information is exchanged between two entities Difference:Data link layer defines communications between stations with a physical connection, whereas transport layer protocols define communications between sites with a logical connection. Two kinds of transport layer protocols: connection-oriented and connection-less.

4 Transport Layer Characteristics Reliable: flow control and error recovery are provided Two kinds: connection-oriented or connection-less Example: Transmission Control Protocol(TCP), User Datagram Protocol(UDP) Transport layer is the lowest layer which provides end-to-end services. The lower three protocols defines how network operates.

5 Transport Layer Functions Logical connection establishment – the transport layer provides the “connection” the user perceives. A user can log on to computers at remote sites, giving them the impression that they are connected. But the connection is not a physical one as exists when connecting wires or making phone calls (using circuit switching).

6 Transport Layer Functions(cont’d) It is similar to a secretary whose function is to place calls in behalf of an executive. The secretary gets the executive’s request, makes the call, and reaches the desired person, thus making the connection. The executive then proceeds to have the conversation independent of the trouble that the secretary may have had in finding the desired person.

7 Transport Layer Functions(cont’d) The connection management defines the rules that allow two users to begin talking with one another as if they were connected directly. The function of defining and setting up the connection is referred to as handshaking.

8 Transport Layer Functions(cont’d) Graceful connection termination The secretary may have to finish the connection by taking down some important information such as client’s address, checking the executive’s schedule for making a future appointment. There are other functions.

9 Connection Oriented Transport Protocol Mechanisms Example: Transmission Control Protocol(TCP)

10 Connection-less Transport Protocol Mechanisms No connection-establishment Datagram delivery User Datagram Protocol(UDP)

11 Motivations Why do we still need transport layer running on top of network layer? –They have similar connection-oriented and connection-less services. –They both provide addressing and flow-control

12 The answers are… What happens if the network layer provides connection-oriented but unreliable service? Suppose that it frequently loses packets? What happens if routers crash all the time? Users have no control over the subnet, so they cannot solve the problem of poor service by using better routers or putting more error handling in the data link layer. So another layer is added to provide better quality of service(QoS).

13 Error Detection at the Transport Level

14 Transport Layer Functions Establishment of connectionless or connection- oriented communication Addressing Flow Control (transport layer) Error detection (transport layer) Interface with upper layers Multiplexing Quality of Service (QoS) In general, a transport layer protocol must provide reliable communications between end users.

15 Reliable Sequencing Network Service Assume arbitrary length message Assume virtually 100% reliable delivery by network service –e.g. reliable packet switched network using X.25 –e.g. frame relay using LAPF control protocol –e.g. IEEE 802.3 using connection oriented LLC service Transport service is end to end protocol between two systems on same network

16 Reliable Sequencing Network Service It is important because IP or other network layer protocols do no guarantee reliable service. Transport protocols must provide acknowledgements and timers to make sure that all of a user’s data are sent and received.

17

18 TCP is not the OSI Transport Layer Protocol TCP is designed and developed by the DoD to run on top of IP for providing connection-oriented transport layer services. OSI transport layer protocol is a generic redesign of transport layer protocol which includes more functions than TCP.

19 OSI vs. TCP OSI transport services include a more complete set of services TCP is not identical to OSI transport protocol in terms of the PDU format, and even some terms. For example, TCP calls its PDU a segment; OSI calls its PDU a TPDU; TCP identifies its application using a port number, OSI uses a Transport Service Access Point(TSAP). We will summarize the comparison at the end of this unit of slides.

20 Issues in OSI Transport Protocols Establishing a Connection Releasing a connection Addressing Quality of Service (QoS) Multiplexing Flow Control and Buffering Crash Recovery

21 Addressing Target user specified by: –User identification: Transport Service Access Point (TSAP) –Machine identification: Network layer address, such as IP address, identifies a host

22 Finding Addresses Four methods –Know address ahead of time e.g. collection of network device stats –Well known addresses –Name server –Sending process request to well known address

23 QoS Another way to look at the transport service is to regard its primary function as enhancing the QoS provided by the network layer. If the network layer is impeccable, the transport layer has an easy job. If the network layer is unreliable, the transport layer has to bridge the gap between what the user wants and the network layer provides.

24 OSI Transport Service Types TP0: no error control, no resynch, no multiplexing TP1: no error control, can resynche, no multiplexing TP2: no error control, multiplexing, no resynch TP3: no error control, can resynch, multiplexing, flow control TP4: runs on top of un-reliable network services such as IP; provides error control, resynch, multiplexing, and flow control. OSI TP4 services are similar to TCP services.

25 QoS What is QoS? It is characterized by a list of QoS parameters which can be negotiated at the connection establishment time. It is specified by users at the user layer. It is up to the transport layer to examine them and determine whether or not it can provide the required service.

26 QoS Parameters Connection establishment delay Connection establishment failure probability Throughput Transit delay Residual error ratio Protection Priority Resilience

27 QoS Parameters Connection establishment delay - the amount of time elapsing between a transport connection being requested and the confirmation being provided by the user of the transport services Connection establishment failure probability - the chance of a connection not being established within the maximum establishment delay time, for example, due to network congestion, lack of table space somewhere, or other internal problems.

28 QoS Parameters Throughput – measures the number of bytes of user data transferred per second. Transit delay – measures the time between a message being sent by the transport user on the source and its being received by the transport user on the destination. Residual error ratio – measures the number of lost or garbled messages as a fraction of the total sent.

29 QoS Parameters Protection – provides a way for the transport user to specify interest in having the transport layer provide protection against unauthorized third party reading or modifying the transmitted data. Priority – specifies the priority of a connection. It is used in the event of congestion to make sure that higher priority connections get serviced before the lower- priority connections.

30 Multiplexing Multiple users employ same transport protocol User identified by transport service access point (TSAP) Multiple transport connections are connected to a single network connection – upward multiplexing –e.g. multiplexing a single virtual X.25 circuit to a number of transport service user X.25 charges per virtual circuit connection time

31 Multiplexing Multiplexing can also be useful in the transport layer for another reason. If the physical connection is a high-speed physical connection and the user layer application also generates data very fast, but the network layer limits the window size to a small constant, several transport layer connection can be established simultaneous.

32 Layer 1 2 3 4 Upward Multiplexing Layer 1 2 3 4 Downward Multiplexing

33 Connection Termination Entity in CLOSE WAIT state sends last data segment, followed by FIN FIN arrives before last data segment Receiver accepts FIN –Closes connection –Loses last data segment Associate sequence number with FIN Receiver waits for all segments before FIN sequence number Loss of segments and obsolete segments –Must explicitly ACK FIN

34 Graceful Close Send FIN i and receive AN i Receive FIN j and send AN j Wait twice maximum expected segment lifetime

35 Crash Recovery After restart all state info is lost Connection is half open –Side that did not crash still thinks it is connected Close connection using persistence timer –Wait for ACK for (time out) * (number of retries) –When expired, close connection and inform user Send RST i in response to any i segment arriving User must decide whether to reconnect –Problems with lost or duplicate data

36 RFCs regarding TCP & UDP Transmission Control Protocol –Connection oriented –RFC 793 User Datagram Protocol (UDP) –Connectionless –RFC 768

37 TCP Mechanisms (1) Connection establishment –Three way handshake –Between pairs of ports –One port can connect to multiple destinations

38 TCP Mechanisms (2) Data transfer –Logical stream of octets –Octets numbered modulo 2 23 –Flow control by credit allocation of number of octets –Data buffered at transmitter and receiver –Congestion control

39 TCP Mechanisms (3) Connection termination –Graceful close –TCP users issues CLOSE primitive –Transport entity sets FIN flag on last segment sent –Abrupt termination by ABORT primitive Entity abandons all attempts to send or receive data RST segment transmitted

40 TCP Header

41

42 TCP Services Reliable communication between pairs of processes Across variety of reliable and unreliable networks and internets Two labeling facilities (part of flags) –Data stream push TCP user can require transmission of all data up to push flag Receiver will deliver in same manner Avoids waiting for full buffers –Urgent data signal Indicates urgent data is upcoming in stream User decides how to handle it

43 TCP Connection Management What exactly is a connection?

44 Establishment and Termination Allow each end to now the other exists Negotiation of optional parameters Triggers allocation of transport entity resources By mutual agreement

45 Connection Establishment Two way handshake –A send SYN, B replies with SYN –Lost SYN handled by re-transmission Can lead to duplicate SYNs –Ignore duplicate SYNs once connected Lost or delayed data segments can cause connection problems –Segment from old connections –Start segment numbers fare removed from previous connection Use SYN i Need ACK to include i Three Way Handshake

46 Two Way Handshake : Obsolete Data Segment

47 Two Way Handshake: Obsolete SYN Segment

48 Three Way Handshake: Examples

49

50

51 Three Way Handshake : State Diagram

52 Flow Control Credit Mechanism A credit, stored in the segment’s window field, specifies the maximum number of bytes the entity (node) sending this segment can receive and buffer from the other entity (node). See Fig. 7.46.

53

54 Congestion Control There are problems that the flow control mechanism cannot solve. Assume that the previous discussion showed that the window sizes (credits) were adjusted based only on what A or B can handle. It didn’t take into account what might be in between. What happens that A and B both are connected to others with T-1 links but use a link capable to transmit 64 kbps between A and B?

55 Congestion Window Due to Jacobson [1988]- Jacobson’s algorithm TCP is enhanced to allow a sending entity to respond to congestion links and to alter the number of segments it can send.

56 Congestion Window We will focus on the transmission from A to B. A maintains a congestion window that specifies the number of bytes it thinks it can send without causing or adding to congestion. If the congestion window’s capacity is larger than A’s credit then A will still not send more than the credit allows. Otherwise, A uses the congestion window’s value to determine how many segments to send.

57 Congestion Window How can A determine when congestion exists? – Timeout mechanism How does A respond to congestion? – reduce the size of the congestion window by half; resend; if timeout occurs again, the window size is reduced by half again.

58 Congestion Window If the congestion is alleviated, A will increase the congestion window size and recalculate the sending window size. Consequently, A will reduce the congestion window much more quickly than it will increase it. A remaining question…

59 Congestion Window How is the initial congestion window size determined? It is similar to the recovery procedure after congestion.

60 Initial Value A will reduce the congestion window much more quickly than it will increase it. The startup procedure is called a slow start.

61 Window Management Slow start –Actual window= MIN[credit, congested window] –Start connection with congested window size=1 –Increment congested window(cwnd) at each ACK, to some max Dynamic windows sizing on congestion –When a timeout occurs –Set slow start threshold to half current congestion window ssthresh=cwnd/2 –Set cwnd = 1 and slow start until cwnd=ssthresh Increasing cwnd by 1 for every ACK –For cwnd >=ssthresh, increase cwnd by 1 for each RTT

62 Congestion Control RFC 1122, Requirements for Internet hosts Retransmission timer management –To control a lost or discard segment, TCP employs a retransmission timer which handles the retransmission time, the waiting time for an ACK of a segment. –For each connection, TCP maintains a variable, RTT, that is the best estimate of the current round trip time to the destination in question. When a segment is sent, a timer is started.

63 Congestion Control When a timer is created, two situations can occur: –If an ACK is received for this particular segment before the timer goes off, the timer is destroyed. –If the timer goes off before the ACK is received, the segment is retransmitted and the timer is reset.

64 Calculation of the Retransmission Time Retransmission = 2 * RTT RTT: estimated Round-Trip Time

65 Calculation of RTT RTT =  * previous RTT + (1 -  ) * current RTT  is usually set to 90%.

66 Karn’s Algorithm Suppose that a segment is not acknowledged during the retransmission period and it is therefore retransmitted. When the sending TCP receives an ACK for this segment, it does not know if the ACK is for the original segment or for the retransmitted one. The value of the new RTT therefore must be calculated based on the departure of the segment.

67 Karn’s Algorithm Do not consider the RTT of a retransmitted segment in the calculation of the new RTT. Do not update the value of the RTT until you send a segment and receive an ACK without the need for retransmission.

68 Karn’s Algorithm If a segment is re-transmitted, the ACK arriving may be: –For the first copy of the segment RTT longer than expected –For second copy No way to tell Do not measure RTT for re-transmitted segments Calculate backoff when re-transmission occurs Use backoff RTO until ACK arrives for segment that has not been re-transmitted

69 Conceptual TCP Primitives Open - request Send - request Deliver - indication Accept - indication Terminate – confirm Etc.

70 Send If no push or close TCP entity transmits at its own convenience Data buffered at transmit buffer May construct segment per data batch May wait for certain amount of data

71 Deliver In absence of push, deliver data at own convenience May deliver as each in order segment received May buffer data from more than one segment

72 Accept Segments may arrive out of order In order –Only accept segments in order –Discard out of order segments In windows –Accept all segments within receive window

73 Retransmit TCP maintains queue of segments transmitted but not acknowledged TCP will retransmit if not ACKed in given time –First only –Batch –Individual

74 Acknowledgement Immediate Cumulative

75

76

77 UDP User datagram protocol (UDP) runs on top of IP. RFC 768 Connectionless service for application level procedures –Unreliable –Delivery and duplication control not guaranteed Reduced overhead There is no formal mechanism for acknowledging errors or a provision for flow control or segment sequencing.

78 UDP Uses Inward data collection Outward data dissemination Request-Response Real time application

79 UDP Header

80 OSI vs. TCP Segment Types Important Data Graceful Termination Piggyback acknowledgement Sequencing Flow Control

81 Socket Programming Sockets Client/Server Model Socket Data Structure Socket Commands Examples: Client Program, Server Program

82 Sockets A socket is a UNIX construct and is the basis for UNIX networking services. A socket is similar to an envelop in which information can be stored.

83

84

85 Client/Server Model An example of file transfer: User requests a file. Client sends request to the server on behalf of the user. Server receives a request from a client and analyzes it. Server copies a file from its auxiliary storage. Server transmits contents of the file back to the client. Client gets files’s contents from the server and make it accessible to the user.

86 Socket Data Structures

87

88

89

90 Suggested Reading Shay: Section 7.5, 7.6 RFC793 (TCP) 768 (UDP) 1112 (Host Extensions for Multicasting)


Download ppt "CSC 336 Data Communications and Networking Lecture 10: Transport Layer Dr. Cheer-Sun Yang Spring 2001."

Similar presentations


Ads by Google