Presentation is loading. Please wait.

Presentation is loading. Please wait.

Section 5: The Transport Layer. 5.2 CS 320 - Computer Networks John Mc Donald, Dept. of Computer Science, NUI Maynooth. Introduction In the previous section.

Similar presentations


Presentation on theme: "Section 5: The Transport Layer. 5.2 CS 320 - Computer Networks John Mc Donald, Dept. of Computer Science, NUI Maynooth. Introduction In the previous section."— Presentation transcript:

1 Section 5: The Transport Layer

2 5.2 CS 320 - Computer Networks John Mc Donald, Dept. of Computer Science, NUI Maynooth. Introduction In the previous section we looked at the services provided by the network layer and specifically how the Internet uses IP to provide unreliable connectionless packet delivery service. Building on top of this, transport protocols must provide reliable end-to-end communication, independent of the underlying network used. In order to describe the services provided by the transport layer we will use TCP as an example

3 5.3 CS 320 - Computer Networks John Mc Donald, Dept. of Computer Science, NUI Maynooth. TCP Services From an application program’s point of view, the service offered by TCP has seven major features: –Connection Orientation –Point-To-Point Communication –Complete Reliability –Full Duplex Communication –Stream Interface –Reliable Connection Start-up –Graceful Connection Shutdown

4 5.4 CS 320 - Computer Networks John Mc Donald, Dept. of Computer Science, NUI Maynooth. Hence, TCP provides a completely reliable (no data duplication or loss), connection oriented, full-duplex stream transport service that allows two application programs to form a connection, send data in either direction, and then terminate the connection. Each TCP connection is started reliably and terminated gracefully, with all data being delivered before the termination occurs.

5 5.5 CS 320 - Computer Networks John Mc Donald, Dept. of Computer Science, NUI Maynooth. TCP and IP With TCP/IP, irrespective of whether the underlying network is a LAN, WAN, single network, or internetwork, the internet protocol (IP) is always present in the network layer. Thus, all transport packets (known as segments) are transferred across the underlying network in IP datagrams. The underlying internet system does not provide hardware support or software support for connections

6 5.6 CS 320 - Computer Networks John Mc Donald, Dept. of Computer Science, NUI Maynooth. Therefore, for TCP to provide an end-to-end protocol, it uses what are known as virtual connections (i.e. connections held in software) In essence TCP treats IP as a packet communication system that connects hosts at two endpoints of a connection, and IP treats each TCP message as data to be transferred This idea is shown graphically in the next slide.

7 5.7 CS 320 - Computer Networks John Mc Donald, Dept. of Computer Science, NUI Maynooth. Courtesy of Computer Networks 3rd Ed. by A.S.Tanenbaum, 1994

8 5.8 CS 320 - Computer Networks John Mc Donald, Dept. of Computer Science, NUI Maynooth. Achieving reliability Problems: –Unreliable delivery by the underlying communications system, and, system crashes and reboots. TCP combines a number of different mechanisms to achieve reliability, of which the more prominent are: –Adaptive retransmission –Sliding window for flow control – 3-way handshake for establishing and releasing connections –(We will not cover congestion control)

9 5.9 CS 320 - Computer Networks John Mc Donald, Dept. of Computer Science, NUI Maynooth. Adaptive retransmission To compensate for packet loss the sender uses a retransmission scheme whereby if a packet is not acknowledged by the receiver in a certain amount of time, the sender assumes it to be lost and retransmits The delay required for the data to reach a destination and an acknowledgement to return depends on the traffic in the internet and the distance to the destination In order for the network usage to be optimised TCP adapts to these delays

10 5.10 CS 320 - Computer Networks John Mc Donald, Dept. of Computer Science, NUI Maynooth. It performs this adaptation policy by building up a sequence of round-trip times for a connection and then performing a statistical analysis of that sequence. This then allows TCP to accurately estimate the round- trip time (RTT) and set the timeout accordingly.

11 5.11 CS 320 - Computer Networks John Mc Donald, Dept. of Computer Science, NUI Maynooth. Flow Control To overcome the maximum achievable bandwidth associated with the positive acknowledgement and retransmission, TCP uses a sliding window protocol, which allows several unacknowledged segments to be present in the network. The next slide show a diagrammatic representation of the technique

12 5.12 CS 320 - Computer Networks John Mc Donald, Dept. of Computer Science, NUI Maynooth. Sliding window 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 Bytes already sent Bytes not sent yet Bytes already acknowledged Bytes not yet acknowledged Window size (determined by the recipient) Front edge of window Back edge of window

13 5.13 CS 320 - Computer Networks John Mc Donald, Dept. of Computer Science, NUI Maynooth. Bytes behind the trailing edge of the window have been both transmitted and acknowledged. Bytes in front of the leading edge of the window have not been sent yet. To control this sliding window, there are three fields with the TDP header. The sequence number is placed in the header by the sender and indicates the byte offset within the data stream at which this segment begins

14 5.14 CS 320 - Computer Networks John Mc Donald, Dept. of Computer Science, NUI Maynooth. The acknowledgement number is used in the acknowledgements returned by the recipient, to indicate which segment is being acknowledged A third field, called the window size field is used in acknowledgement packets to indicate how many more bytes of data (beyond the one that is currently being acknowledged) the recipient is willing to accept before further acknowledgements are sent

15 5.15 CS 320 - Computer Networks John Mc Donald, Dept. of Computer Science, NUI Maynooth. Three-Way Handshake To guarantee that connection are established or terminated reliable, TCP uses a 3-way handshake in which three message are exchanged (a minimum of 3 message are required to ensure setup or release) When setting up a connection TCP uses synchronisation segments ( SYN segment) When releasing a segment it uses finish segments ( FIN segments)

16 5.16 CS 320 - Computer Networks John Mc Donald, Dept. of Computer Science, NUI Maynooth. Setting up a connection Send SYN Send SYN + ACK Send ACK Receive SYN Receive SYN + ACK

17 5.17 CS 320 - Computer Networks John Mc Donald, Dept. of Computer Science, NUI Maynooth. Accessing TCP Services Access to the services provided by TCP can only be granted through t ransport s ervice a ccess p oints (TSAPs) known as ports. To use a port a socket must be created and bound to it. Each socket is addressed by a number made up of the machines IP address and a 16-bit port number local to that host (e.g. 149.157.245.10,23 is the telnet port on csa10) Port numbers below 1024 are called well-known ports and are reserved for standard services

18 5.18 CS 320 - Computer Networks John Mc Donald, Dept. of Computer Science, NUI Maynooth. Berkeley sockets One implementation of TCP used in Berkeley UNIX a set of socket primitives described below –SOCKET: Create a new communication end point –BIND: Attach a local address to a socket –LISTEN: Announce willingness to accept connections –CONNECT: Actively attempt to establish a connection –SEND: Send some data over the connection –RECEIVE: Receive some data from the connection –CLOSE: Release the connection

19 5.19 CS 320 - Computer Networks John Mc Donald, Dept. of Computer Science, NUI Maynooth. Building servers Servers execute the first four primitives in the order given A successful call to SOCKET return an ordinary file descriptor that may be used in succeeding calls. BIND assigns an specific address to the newly created socket, at which stage clients who know this address may connect to it The LISTEN call allows a number of clients to try and connect simultaneously in which case they will be queued for service

20 5.20 CS 320 - Computer Networks John Mc Donald, Dept. of Computer Science, NUI Maynooth. LISTEN is non-blocking i.e. once called it sets up the queue, tells the TCP to look after it, and returns control to the programs When the server wishes to accept an incoming connection it executes the ACCEPT call. If a client is waiting a connection is set-up otherwise the call blocks until a client tries to connect. ACCEPT returns a new file descriptor specifically assigned for communication between the server and the new client

21 5.21 CS 320 - Computer Networks John Mc Donald, Dept. of Computer Science, NUI Maynooth. Building clients When a client wishes to utilise the services of TCP it must also first make a call to SOCKET. In this case however the address of the TSAP does not matter since the client connects to the server (not vice- versa) Once the socket has been created the CONNECT call asks TCP to make a connection to the server SEND and RECEIVE may then be used to exchange data To release a connection a call to CLOSE is made

22 The End!


Download ppt "Section 5: The Transport Layer. 5.2 CS 320 - Computer Networks John Mc Donald, Dept. of Computer Science, NUI Maynooth. Introduction In the previous section."

Similar presentations


Ads by Google