680 likes | 992 Views
In the Name of God Computer Networks Chapter 6: The Transport Layer. Dr. Shahriar Bijani Shahed University May 2014. References: A . S. Tanenbaum and D. J. Wetherall , Computer Networks (5th Edition ), Pearson Education, the book slides, 2011.
E N D
In the Name of GodComputer NetworksChapter 6: The Transport Layer Dr. ShahriarBijani Shahed University May 2014
References: • A. S. Tanenbaum and D. J. Wetherall, Computer Networks (5th Edition), Pearson Education, the book slides, 2011. • B. A. Forouzan, Introduction to the TransportLayer, TCP/IP Protocol Suite, 5th Edition, McGraw Hill, lecture slides, 2012.
The OSI Model APPLICATION PRESENTATION • TCP/IP SESSION TRANSPORT NETWORK DATA LINK PHYSICAL
The Transport layer duties • Packetizing • Sender side: breaks application messages into segments, passes them to network layer • Transport layer at the receiving host deliver data to the receiving process • Connection control • Connection-oriented • Connectionless • Addressing • Port numbers to identify which network application • Reliability • Flow control • Error Control
PROCESS-TO-PROCESSDELIVERY • The transport layer is responsible for process-to-process delivery: the delivery of a packet, part of a message, from one process to another. Two processes communicate in a client/server relationship, • In Client/Server communication, four entities must be defined: • Sending Node • Local Host IP • Local Process Port number • Receiving Node • Remote host IP • Remote Process ID Port number
Processes communicating across network • Process is an instance of a program in execution. • Processes on two hosts communicate with each other by sending and receiving messages • The process receives messages from, and sends messages into the network through its socket • A socket is the interface between the application layer and the transport layer within a host. • Sockets are the programming interface used to build network applications over the internet. • Programmers can select which transport layer protocol (UDP or TCP) to be used by the application and select few transport-layer parameters (maximum buffer size, Maximum segment size, starting sequence number of segment).
Transport Service • Upper Layer Services • Transport Service Primitives • Berkeley Sockets
Services Provided to the Upper Layers The network, transport, and application layers
Transport Service Primitives (1) The primitives for a simple transport service
Transport Service Primitives (2) Nesting of TPDUs, packets, and frames.
Berkeley Sockets (1) A state diagram for a simple connection management scheme. Transitions labeled in italics are caused by packet arrivals. The solid lines show the client’s state sequence. The dashed lines show the server’s state sequence.
Berkeley Sockets (2) The socket primitives for TCP
Example of Socket Programming: An Internet File Server (1) . . . Client code using sockets
Example of Socket Programming: An Internet File Server (2) . . . . . . Client code using sockets
Example of Socket Programming: An Internet File Server (3) . . . Client code using sockets
Example of Socket Programming: An Internet File Server (4) . . . Server code
Example of Socket Programming: An Internet File Server (5) . . . . . . Server code
Example of Socket Programming: An Internet File Server (6) . . . Server code
Elements of Transport Protocols (1) • Addressing • Connection establishment • Connection release • Error control and flow control • Multiplexing • Crash recovery
Elements of Transport Protocols (2) • Environment of the data link layer. • Environment of the transport layer.
Addressing TSAPs (Transport Service Access Points)= port number NSAPs (Network Service Access Points)
Addressing How a user process in host 1 establishes a connection with a mail server in host 2 via a process server.
Port numbers Transport layer at the receiving host delivers data to the socket There should be a unique identifier for each socket. Socket identifier is called socket address Socket address = IP address & Port number
IP addresses versus port numbers Process-to-Process delivery needs IP address and Port number
IANA ranges Port numbers are 16-bit integers between 0 - 65535 • Well-known: Assigned and controlled by Internet Assigned Numbers AuthorityIANA for example: FTP 20,21, TELNET 23, SMTP 25, HTTP 80
Error control Why we need error control at the transport layer?
Connection Establishment • Establishing a connection sounds easy, but it is actually surprisingly tricky. At first glance, it would seem sufficient for one transport entity to just send a CONNECTION REQUEST TPDU to the destination and wait for a CONNECTION ACCEPTED reply. • The problem occurs when the network can lose, store, and duplicate packets. This behavior causes serious complications. • Restrict packet lifetime • Equipping each host with a time-of-day clock. • Three-way handshake
Connection Establishment Techniques for restricting packet lifetime • Restricted network design. • Putting a hop counter in each packet. • Timestamping each packet.
Connection Establishment (2) • TPDUs may not enter the forbidden region. • The resynchronization problem.
Connection Establishment Three protocol scenarios for establishing a connection using a three-way handshake. CR denotes CONNECTION REQUEST. Normal operation.
Connection Establishment Three protocol scenarios for establishing a connection using a three-way handshake. CR denotes CONNECTION REQUEST. Old duplicate CONNECTION REQUEST appearing out of no-where.
Connection Establishment Three protocol scenarios for establishing a connection using a three-way handshake. CR denotes CONNECTION REQUEST. Duplicate CONNECTION REQUEST and duplicate ACK
Connection Release Sudden disconnection with loss of data
Connection Release Four protocol scenarios for releasing a connection. (a) Normal case of three-way handshake
Connection Release (4) Four protocol scenarios for releasing a connection. (b) Final ACK lost.
Connection Release (5) Four protocol scenarios for releasing a connection. (c) Response lost
Connection Release (6) Four protocol scenarios for releasing a connection. (d) Response lost and subsequent DRs lost.
Multiplexing (a) Multiplexing. (b) Inverse multiplexing.
segment - unit of data exchanged between transport layer entities Demultiplexing: delivering received segments to correct app layer processes M M M M application transport network application transport network application transport network H n Multiplexing/demultiplexing How hosts handle more than one session simultaneously receiver P3 P4 application-layer data segment header P1 P2 segment H t M segment sender B sender A
multiplexing/demultiplexing in the Internet: based on sender, receiver port numbers, IP addresses source, dest port #s in each segment recall: well-known port numbers for specific applications Multiplexing: Multiplexing/demultiplexing gathering data from multiple app processes, enveloping data with header (later used for demultiplexing) 32 bits source port # dest port # other header fields application data (message) TCP/UDP segment format
Source IP: C Dest IP: B source port: x dest. port: 80 Source IP: C Dest IP: B source port: y dest. port: 80 Source IP: A Dest IP: B source port: x dest. port: 80 source port:23 dest. port: x source port: x dest. port: 23 Multiplexing/demultiplexing: examples Web client host C server B host A port use: simple telnet app (Note how port 23 at server must be shared whereas port x at host can be reserved) Web server B Web client host A port use: Web server Q: how does the server know which packets go with which process?
Congestion Control • Desirable bandwidth allocation • Regulating the sending rate
The Internet Transport Layer • The Internet supports two transport layer protocols: • The Transport Control Protocol (TCP) for reliable service • The Unreliable (User) Datagram Protocol (UDP)