340 likes | 404 Views
Learn about transport layer services, protocols, and connection management. Understand QoS, avoiding network types, primitives, and performance issues. Explore UDP, TCP, and connection release techniques.
E N D
The Transport Layer Tanenbaum Ch.6 4343 X2 – 2007
Outline • Transport Service • Elements of Transport Protocols • UDP • TCP • Performance Issues 4343 X2 – 2007
Transport Layer Services • The goal of the transport layer is to provide efficient, reliable and cost-effective service to users. • Users are normally processes in the application layer. • The hardware/software that does this work is known as the transport entity. 4343 X2 – 2007
Transport Services • There are two types of transport services: • connection-oriented • connectionless • This is very similar to the network layer. Why bother having two? • The answer is subtle – network layer code runs on routers while transport layer code is run on user’s machines. 4343 X2 – 2007
Transport QoS • The introduction of the Transport Layer is to add an additional layer where the user has some control over the QoS. Users cannot control the QoS in the Network Layer. • The Transport Layer can manage connections at the Network Layer, picking up dropped connections and making sure that the application doesn’t have to deal with problems 4343 X2 – 2007
Avoiding Different Network Types • The Transport Layer is responsible for hiding the underlying Network Layer. • This allows people to code for one basic network standard without having to worry about the different underlying networks. • This makes the Transport Layer the first layer in the transport service user upper levels, connecting directly to the transport service provider lower levels. 4343 X2 – 2007
Transport Layer Primitives • The messages sent from one transport entity to another is known as a TPDU (Transport Protocol Data Unit). 4343 X2 – 2007
Elements of Transport Protocols • Addressing • Connection Establishment • Connection Release • Flow Control and Buffering • Multiplexing • Crash Recovery 4343 X2 – 2007
Transport Protocols • The transports protocols resemble the data link protocols from Chapter 3. • Both deal with error control, sequencing, flow control, etc. • There are differences, mainly associated with the different levels at which they are implemented. 4343 X2 – 2007
TP - Addressing • Where to we send data? • On the Internet, we make connections to ports or AAL-SAPs. The book uses the generic term TSAP (Transport Service Access Point). • An IP address is an example of a Network Service Access Point (NSAP). 4343 X2 – 2007
Common Ports • All ports under 1024 are reserved for system use, although system administrators are able to access and even remap these ports. • Applications look for common servers under common ports. • These servers often don’t run all the time – an inet deamon starts them when needed. 4343 X2 – 2007
TSAPs and NSAPs 4343 X2 – 2007
Connection Establishment • Although connections seem simple, they are complicated because the network can lose, store and duplicate packets. • Delayed duplicate packets can cause serious troubles. • Consider a transaction happening twice instead of once… • We need to figure out a way to deal with duplicate packets. 4343 X2 – 2007
Avoiding Duplicates • We could use throwaway transport addresses. • We could give each connection a connection identifier. • We could devise a way to kill off old packets in the network. This would make the problem more manageable. 4343 X2 – 2007
Connections • The three-way handshake was introduced to establish a connection. • The first machine sends a CONNECTION REQUEST to host 2 containing a sequence number. • Host 2 replies with an ACK acknowledging the sequence number and sending it’s own initial sequence number. • Host 1 acknowledges Host 2’s choice of sequence number in the first data packet. 4343 X2 – 2007
Connection Release • We can release the connection symmetrically or asymmetrically. • Asymmetric is just like a telephone – when one person ends the connection, it is broken. • Asymmetric release can cause data loss if one side sends data that is not received before the disconnect. 4343 X2 – 2007
Connection Release (cont’d) • Symmetric – treats the connection like two unidirectional connections, requiring each end of the connection to be released. • Unfortunately, determining when the two sides are done is difficult. • This problem is known as the two-army problem. 4343 X2 – 2007
Connection Release • Host 1 sends a Disconnect Request (DR) to Host 2. • Host 2 replies with a DR and starts a timer just in case the reply is lost. • Host 1 will ACK the DR from Host 2 and release the connection. • When the ACK arrives, Host 2 will drop the connection. • If the final ACK is lost, the time will take care of the disconnection. 4343 X2 – 2007
Connection Release Protocols 4343 X2 – 2007
Connection Release Protocols 2 4343 X2 – 2007
User Datagram Protocol (UDP) • UDP is a connectionless transport protocol used in the Internet. • UDP is used to send encapsulated datagrams without having to establish a connection. • UDP is described in RFC 768. 4343 X2 – 2007
UDP Header • 8 bytes followed by the payload. • It should be noted that the advantage of UDP over IP packets is the use of the source and destination ports. 4343 X2 – 2007
Transmission Control Protocol (TCP) • Was designed to provide a reliable end-to-end byte stream. • This stream is supposed to work well even over an unreliable network. • TCP must dynamically adapt to different networks, delays, packet sizes, etc and must be robust to failures. 4343 X2 – 2007
TCP Service Model • Service for TCP is obtained using sockets. • Sockets have an IP address and a port number. • The port number is used to specify where on the machine the data should go. • All TCP connections are full duplex and point-to-point. 4343 X2 – 2007
TCP Service Model (cont’d) • TCP can buffer data at its discretion. • A PUSH flag can be set to send the data right away. • We can also use the URGENT DATA flag when sending special data, such as hitting the DEL key or the CTRL-C to try and stop a process from continuing. 4343 X2 – 2007
TCP Protocol • Uses a 20 byte header (lots of overhead) • Size is restricted by two things: • the IP payload size (65,515 bytes excluding the header) • the maximum transfer unit (MTU) for the network (usually 1500 bytes) 4343 X2 – 2007
TCP Header 4343 X2 – 2007
TCP Connection Establishment • The three-way handshake is used to establish connections. • One side (the server) passively listens for incoming connections • The other side (the client) connects to the server with a connection request and sets out the parameters. • The server replies with an acknowledgement and the connection is set. 4343 X2 – 2007
TCP Connection Establishment 4343 X2 – 2007
TCP Connection Release • To end a connection, either party can send a TCP segment with the FIN bit set, meaning that it has no more data to transmit. • Once the FIN is acknowledged, then data transfer in that direction is shut down. • The same must be done to shut down data transfer in the other direction. 4343 X2 – 2007
TCP Connection Management Model 4343 X2 – 2007
TCP Congestion Control • TCP does most of the work in the Internet when it comes to congestion control. • TCP is responsible for slowing down the rate of transmitting packets in order to help ease congestion in the network. • TCP will adjust the size of the window used to transmit data based on the congestion in the network. 4343 X2 – 2007
Congestion 4343 X2 – 2007
Congestion Windows • Each sender maintains two windows: • a window to tell it how large a packet the receiver can receive • a window to tell it how large a packet the network can handle • The sender will choose the smallest of these two sizes to send. 4343 X2 – 2007