The Transport Layer. The need for the transport layer

Similar documents
The OSI Reference Model. EECC694 - Shaaban

Chapter 6. The Transport Layer. The Transport Service. Services Provided to the Upper Layers. Transport Service Primitives (3) 10/7/2010

Layer 4 - Transport Layer

Upper Layer Services. Berkeley Sockets Example of Socket Programming: Internet File Server

Jaringan Komputer. The Transport Layer

EEC-682/782 Computer Networks I

EEC-484/584 Computer Networks. Lecture 16. Wenbing Zhao

Elements of Transport Protocols

CompSci 356: Computer Network Architectures Lecture 3: Hardware and physical links References: Chap 1.4, 1.5 of [PD] Xiaowei Yang

6.2 Elements of Transport Protocols

CompSci 356: Computer Network Architectures. Lecture 3: Network Architecture Examples and Lab 1. Xiaowei Yang

6.2 Elements of Transport Protocols

The Transport Layer. Why is there a transport layer? Addressing

Lecture 20 Overview. Last Lecture. This Lecture. Next Lecture. Transport Control Protocol (1) Transport Control Protocol (2) Source: chapters 23, 24

Sockets. Dong-kun Shin Embedded Software Laboratory Sungkyunkwan University Embedded Software Lab.

Sockets. Dong-kun Shin Embedded Software Laboratory Sungkyunkwan University Embedded Software Lab.

EEC-682/782 Computer Networks I

Communication Systems Transport Layer

CMPE 150 Winter 2009

Transport Layer Chapter 6

COMPUTER NETWORKS - UNIT 4 Y3/S5

PA #2 Reviews. set_name, get_name, del_name. Questions? Will be modified after PA #4 ~

CMSC 417. Computer Networks Prof. Ashok K Agrawala Ashok Agrawala. October 11, 2018

CMSC 417. Computer Networks Prof. Ashok K Agrawala Ashok Agrawala. October 25, 2018

ET4254 Communications and Networking 1

UDP CONNECT TO A SERVER

QUIZ: Longest Matching Prefix

EEC-484/584 Computer Networks


The User Datagram Protocol

NWEN 243. Networked Applications. Layer 4 TCP and UDP

Sockets. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

User Datagram Protocol

Introduction to Client-Server Model

TCP : Fundamentals of Computer Networks Bill Nace

MIDTERM EXAMINATION #2 OPERATING SYSTEM CONCEPTS U N I V E R S I T Y O F W I N D S O R S C H O O L O F C O M P U T E R S C I E N C E

Chapter 3 Transport Layer

Hyo-bong Son Computer Systems Laboratory Sungkyunkwan University

CMSC 417. Computer Networks Prof. Ashok K Agrawala Ashok Agrawala Set 7. October 16 CMSC417 Set 7 1

Chapter 2 Applications and

THE TRANSPORT LAYER UNIT IV

Chapter 3 Transport Layer

ICS 451: Today's plan. Sliding Window Reliable Transmission Acknowledgements Windows and Bandwidth-Delay Product Retransmission Timers Connections

Transport Protocols & TCP TCP

Request for Comments: 1007 June 1987

The Transport Layer: TCP & Reliable Data Transfer

UNIT IV -- TRANSPORT LAYER

Transport Protocols. ISO Defined Types of Network Service: rate and acceptable rate of signaled failures.

Interprocess Communication Mechanisms

ECE 650 Systems Programming & Engineering. Spring 2018

CMSC 417. Computer Networks Prof. Ashok K Agrawala Ashok Agrawala Set 7. April 12 CMSC417 Set 7 1

1.What are the services provided by the transport layer to the upper layers?

Transport Layer. Application / Transport Interface. Transport Layer Services. Transport Layer Connections

Interprocess Communication Mechanisms

CMSC 417. Computer Networks Prof. Ashok K Agrawala Ashok Agrawala Set 7. November 14 CMSC417 Set 7 1

NT1210 Introduction to Networking. Unit 10

Page 1. Goals for Today" Discussion" Example: Reliable File Transfer" CS162 Operating Systems and Systems Programming Lecture 11

CS 3516: Computer Networks

Transport Protocols and TCP: Review

Lecture 3: The Transport Layer: UDP and TCP

Lecture 7. Followup. Review. Communication Interface. Socket Communication. Client-Server Model. Socket Programming January 28, 2005

CS4700/CS5700 Fundamentals of Computer Networking

CSCI 415 Computer Networks Homework 2 Due 02/13/08

Network Communication

Transport Layer Marcos Vieira

Chapter 6. What happens at the Transport Layer? Services provided Transport protocols UDP TCP Flow control Congestion control

ECE 435 Network Engineering Lecture 10

Intro to LAN/WAN. Transport Layer

CSC Systems Programming Fall Lecture - XV Network Programming - I. Tevfik Ko!ar. Louisiana State University. November 9 th, 2010

Transport Layer (TCP/UDP)

Sliding Window Protocols, Connection Management, and TCP Reliability

Code No: RR Set No. 1

Client software design

CS307 Operating Systems Processes

Processes. Process Concept. The Process. The Process (Cont.) Process Control Block (PCB) Process State

Tutorial on Socket Programming

32 bits. source port # dest port # sequence number acknowledgement number not used. checksum. Options (variable length)

Transport Protocols and TCP

CS419: Computer Networks. Lecture 10, Part 2: Apr 11, 2005 Transport: TCP mechanics (RFCs: 793, 1122, 1323, 2018, 2581)

CMSC 417. Computer Networks Prof. Ashok K Agrawala Ashok Agrawala Set 7. September 15 CMSC417 Set 7 1

Transport Layer: Outline

Piotr Mielecki Ph. D.

CSCI Topics: Internet Programming Fall 2008

Message passing systems are popular because they support client-server interactions, where: clients send messages to servers requesting a server.

Transport Layer: outline

Lecture 5: Flow Control. CSE 123: Computer Networks Alex C. Snoeren

Communication. Communication. Distributed Systems. Networks and protocols Sockets Remote Invocation Messages Streams. Fall /10/2001 DoCS

ECE 435 Network Engineering Lecture 9

Transport layer. UDP: User Datagram Protocol [RFC 768] Review principles: Instantiation in the Internet UDP TCP

Transport layer. Review principles: Instantiation in the Internet UDP TCP. Reliable data transfer Flow control Congestion control

Lecture 8. TCP/IP Transport Layer (2)

Outline. CS5984 Mobile Computing

19: Networking. Networking Hardware. Mark Handley

RSC Part III: Transport Layer 3. TCP

Application Programming Interfaces

INF4/MSc Computer Networking. Lectures 3-4 Transport layer protocols TCP/UDP automatic repeat request

Module 25 TCP Timers and delayed duplicates problem in TCP

CSC 4900 Computer Networks: TCP

9th Slide Set Computer Networks

Transcription:

The Transport Layer Aims To explain:- The need for the transport layer A simple exemplar Transport in IP and ATM Outcomes To understand the need for the layer and the solution adopted adopted when internetworking with the internet and the ATM. 1

The Transport Layer Aims to provide Efficient Reliable Cost effective Service to the applications layer. Using the services provided by the network layer. Why is it necessary? 2

Quality of Service Parameters Connection Establishment Delay Connection Failure Probability Throughput Transit Delay Residual error ratio Protection Priority Resilience 3

TP Data Units Frame header Packet header TPDU header TPDU payload Packet payload Frame payload The Nesting of TPDU Packets and Frames 4

The Transport Layer Primitives Primitive TPDU sent LISTEN - CONNECT CONNECTION REQ. SEND DATA RECEIVE DATA DISCONNECT DISCONNECTION REQ. CLIENTs Call servers. SERVERs wait to be asked. 5

Connection Management Connection request TPDU received IDLE Connect primitive executed PASSIVE ESTABLISHMENT PENDING ACTIVE ESTABLISHMENT PENDING Connect primitive executed Disconnection request TPDU received PASSIVE DISCONNECT PENDING ESTABLISHED Connection accepted TPDU received Disconnect primitive executed ACTIVE DISCONNECT PENDING Disconnect primitive executed IDLE Disconnection request TPDU received A State Diagram for a Connection Management Scheme Solid lines are client transitions. Dashed lines are server transitions. 6

Berkley Sockets Transport for Berkley Unix. Primitive SOCKET BIND LISTEN ACCEPT CONNECT SEND RECEIVE CLOSE Meaning Create a new end port Attach a local address to a socket Will accept connections Block unitl connection Establish a connection Send data Receive data Release connection The server issues SOCKET BIND LISTEN ACCEPT 7

Berkley Sockets II The client issues SOCKET CONNECT Both sides now issue SEND RECEIVE CLOSE 8

#include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #define SERVER_PORT 5432 #define MAX_LINE 256 A Client Server Echo int main(int argc, char *argv[]) { FILE *fp; struct hostent *hp; struct sockaddr_in sin; char *host; char buf[max_line]; int s,len; if(argc<2){ printf("give me a host name matey"); exit(0); } host=argv[1]; if(!(hp=gethostbyname(host))){ /*get IP address of the host */ printf("%s is unknown",host); exit(0); } /* build address structure */ bzero((char*)&sin, sizeof(sin)); sin.sin_family=af_inet; bcopy(hp->h_addr,(char*)&sin.sin_addr,hp->h_length); sin.sin_port=htons(server_port); 9

/* open as active */ if((s=socket(pf_inet,sock_stream,0))<0){ printf("socket creation error"); exit(0); } /* connect socket to address */ if(connect(s,(struct sockaddr*)&sin, sizeof(sin))<0) { printf("connection error"); close(s); exit(0); } /* send some lines */ while(fgets(buf,sizeof(buf),stdin)){ buf[max_line-1]= \0 ; len=strlen(buf)+1; send(s,buf,len,0); } }

#include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #define SERVER_PORT 5432 #define MAX_LINE 256 #define MAX_PENDING 5 int main() { struct sockaddr_in sin; char *host; char buf[max_line]; int s,new_s,len; A Client Server Echo /* build address structure */ bzero((char*)&sin, sizeof(sin)); sin.sin_family=af_inet; sin.sin_addr.s_addr=inaddr_any; sin.sin_port=htons(server_port); /* open as passive */ if((s=socket(pf_inet,sock_stream,0))<0){ printf("socket creation error"); exit(0); } 10

/* bind socket to address */ if(bind(s,(struct sockaddr*)&sin, sizeof(sin))<0) { printf("binding error"); close(s); exit(0); } listen(s,max_pending); /* get some lines */ while(1){ if((new_s=accept(s,(struct sockaddr *)&sin,&len))<0) { printf("acceptance error"); close(s); exit(0); } while(len=recv(new_s,buf,sizeof(buf),0)) puts(buf); close(new_s); } }

The Transport Layer Protocols The transport layer deals with:- error control sequencing flow control In common with the data link. Router Router Subnet Physical communication channel Host (a) (b) The Data Link and Transport Environments 11

Access Points Host 1 Host 2 Application process TSAP 6 Application layer Server Network connection starts here Transport connection starts here Transport layer TSAP 122 NSAP Network layer NSAP Data link layer Phys Physical layer TSAPs, NSAPs and Connections 12

Daemon Processes Host 1 Host 2 Host 1 Host 2 Layer User Process Server User Process Server Time of day server 4 TSAP (a) (b) Host 1 establishes a connection with host 2 process server Unix. Saves having lots of active daemons. name server might live here too. 13

Establishing a Connection I This is problematic when the network can lose, store and duplicate packets. Duplication is a big problem. new TSAPs connection IDs kill off the old 1. restrict subnet 2. hop counter 3. timeout 14

Establishing a Connection II Sequence numbers 120 80 70 60 Forbidden message Forbidden region T Restart after crash with 70 Sequence numbers 2 k 1 T 0 0 30 60 90 Time (a) 120 150 180 Actual sequence numbers used Time (b) a. TPDUs may not enter the forbidden region. b. The resynchronisation problem 15

Establishing a Connection III Host 1 Host 2 CR (seq = x) Host 1 Host 2 Old duplicate CR (seq = x) Time ACK (seq = y, ACK = x) ACK (seq = y, ACK = x) DATA (seq = x, ACK = y) REJECT (ACK = y) (a) (b) Host 1 Host 2 Old duplicate CR (seq = x) ACK (seq = y, ACK = x) Old duplicate DATA (seq = x, ACK = z) REJECT (ACK = y) (c) The 3-way handshake 16

Releasing a Connection I Host 1 Host 2 CR ACC Time DATA DATA DR No data are delivered after a disconnect request Asynchronous Release Host 2 issues a DISCONNECT REQ. before Host 1 has finished sending. The remaining data are lost. Synchronous Release Host 2 issues DR but link is still established Host 1 issues DC both disconnect. 17

Releasing over a Hostile Channel B Blue army #1 B Blue army #2 W White army The 2 Army Problem 1. #1 we attack at 2pm. ok? 2. #2 ok 3. #1 was that you who said ok #2? 4. #2 yes 5.... 18

Releasing a Connection III Host 1 Host 2 Send DR + start timer DR Host 1 Host 2 Send DR + start timer DR Release connection DR Send DR + start timer Release connection DR Send DR + start timer Send ACK ACK Release connection Send ACK ACK Lost (Timeout) release connection (a) (b) Host 1 Host 2 Send DR + start timer ( Timeout) send DR + start timer Release connection Lost DR DR DR DR Send DR & start timer Send DR & start timer Host 1 Host 2 Send DR + start timer ( Timeout) send DR + start timer Lost DR Lost Send DR & start timer Send ACK ACK Release connection (N Timeouts) release connection (Timeout) release connection (c) 4 scenarios for connection release (d) 19

Flow Control If the receiver knows that the sender keeps the TPDU until it is acknowledged then it need not buffer it. eg. If dynamic buffer allocation is used and space is exhausted, then the TPDU can be discarded. For an unreliable network connection the sender must keep a copy of everything. For a reliable connection in which the receiver always has room then the sender need not buffer. Whatever:- the network acknowledgement means only that the TPDU was delivered, not that it was accepted. 20

Flow Control Buffer Schemes TPDU 1 TPDU 2 TPDU 3 (a) (b) Unused space TPDU 4 (c) a. Chained fixed size b. chained variable size c. One circular per connection 21

A Credit Request Scheme A Message B Comments 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 < request 8 buffers> <ack = 15, buf = 4> <seq = 0, data = m0> <seq = 1, data = m1> <seq = 2, data = m2> <ack = 1, buf = 3> <seq = 3, data = m3> <seq = 4, data = m4> <seq = 2, data = m2> <ack = 4, buf = 0> <ack = 4, buf = 1> <ack = 4, buf = 2> <seq = 5, data = m5> <seq = 6, data = m6> <ack = 6, buf = 0> <ack = 6, buf = 4> A wants 8 buffers B grants messages 0-3 only A has 3 buffers left now A has 2 buffers left now Message lost but A thinks it has 1 left B acknowledges 0 and 1, permits 2-4 A has buffer left A has 0 buffers left, and must stop A times out and retransmits Everything acknowledged, but A still blocked A may now send 5 B found a new buffer somewhere A has 1 buffer left A is now blocked again A is still blocked Potential deadlock Dynamic buffer allocation.... is a lost TPDU 22

Multiplexing Layer 4 Transport address Network address 3 2 Router lines 1 (a) To router (b) a. Upward multiplexing b. downward multiplexing Lines in the network layer cost. Send everything out on one network connection and let the Transport layer sort it out. Bandwidth use. One high speed line. n-bits in protocol implies wait for all acks after 2 n messages. Use multiple network connections. 23

Crash Recovery If a router crashes the network layer can handle it. The transport layer expects lost TPDUs and should handle it. Host crashes are different. Strategy used by receiving host First ACK, then write First write, then ACK Strategy used by sending host AC(W) AWC C(AW) C(WA) W AC WC(A) Always retransmit OK DUP OK OK DUP DUP Never retransmit Retransmit in S0 Retransmit in S1 LOST OK LOST OK DUP LOST LOST OK OK LOST OK OK LOST DUP OK OK OK DUP OK = Protocol functions correctly DUP = Protocol generates a duplicate message LOST = Protocol loses a message Different combinations of client server strategy S0 - no outstanding packets S1 - an unacked TPDU outstanding. A - acknowledge. W - write to process. C - crash. 24