Transport Layer Transport Layer Chapter 3: Transport Layer Mobile network Our goals: Global ISP understand principles learn about transport Chapter 3 behind transport layer protocols in the Transport Layer Internet: layer services: Home network multiplexing/demultipl UDP: connectionless Regional ISP transport exing Yanmin Zhu reliable data transfer TCP: connection-oriented transport Institutional network flow control Department of Computer TCP congestion control congestion control Science and Engineering CSE Department CSE Department 1 2 Transport Layer Transport Layer Outline Transport services and protocols application provide logical communication transport network Transport-layer Connection-oriented between app processes data link physical services transport: TCP running on different hosts transport protocols run in Multiplexing and segment structure end systems demultiplexing reliable data transfer send side: breaks app flow control Connectionless messages into segments, connection management transport: UDP passes to network layer Principles of congestion Principles of reliable rcv side: reassembles application control segments into messages, transport data transfer network data link passes to app layer TCP congestion control physical more than one transport protocol available to apps Internet: TCP and UDP CSE Department CSE Department 3 4 Transport Layer Transport Layer Internet transport-layer protocols Transport vs. network layer reliable, in-order Household analogy: application network layer: logical transport delivery (TCP) network communication 12 kids sending letters to data link physical congestion control network 12 kids between hosts data link network physical flow control data link processes = kids physical connection setup transport layer: logical app messages = letters unreliable, unordered network data link communication in envelopes delivery: UDP physical network data link between processes hosts = houses physical no-frills extension of network relies on network layer data link “best - effort” IP transport protocol = application physical network transport services data link services not available: network Ann and Bill physical data link enhances physical delay guarantees network-layer protocol bandwidth guarantees = postal service CSE Department CSE Department 5 6 1
Transport Layer Transport Layer Outline Message, Segment, Datagram Transport-layer Connection-oriented APPLICATION LAYER services transport: TCP (Message) Multiplexing and segment structure TRANSPORT LAYER (Segment) demultiplexing reliable data transfer flow control NETWORK LAYER Connectionless (Datagram) connection management transport: UDP Principles of congestion message Principles of reliable control data transfer TCP congestion control app datagram tran. data head head head segment datagram CSE Department CSE Department 7 8 Transport Layer Transport Layer How demultiplexing works Multiplexing/demultiplexing Multiplexing at send host: Demultiplexing at rcv host: gathering data from multiple host receives IP datagrams delivering received segments 32 bits sockets, enveloping data with each datagram has source to correct socket header (later used for source port # dest port # IP address, destination IP demultiplexing) address = socket = process each datagram carries 1 other header fields transport-layer segment P4 P1 application P3 P1 P2 application application each segment has source, destination port number transport transport transport application network data network network host uses IP addresses & port (message) link link link numbers to direct segment to appropriate socket physical physical physical TCP/UDP segment format host 3 host 1 host 2 CSE Department CSE Department 9 10 Transport Layer Transport Layer Connectionless demultiplexing Connectionless demux (cont) When host receives UDP Create sockets with dest. DatagramSocket serverSocket = new DatagramSocket(6428); segment: IPs and port numbers: checks destination port P2 P1 DatagramSocket mySocket1 = new P1 P3 number in segment DatagramSocket(192.168.0.1, 9157 5775 6428 directs UDP segment to 8081); socket with that port DatagramSocket mySocket2 = new number DatagramSocket(192.168.0.1, SP: 6428 SP: 6428 8082); IP datagrams with DP: 9157 DP: 5775 UDP socket identified by different source IP SP: 9157 SP: 5775 two-tuple: addresses and/or source client DP: 6428 DP: 6428 Client server ( dest IP address, dest port number) port numbers directed IP: A IP:B IP: C to same socket SP provides “return address” CSE Department CSE Department 11 12 2
Transport Layer Transport Layer Connection-oriented demux Connection-oriented demux (cont) TCP socket identified Server host may support by 4-tuple: many simultaneous TCP sockets: source IP address P1 P1 P4 P5 P6 P2 P3 9157 80 80 80 5775 9157 source port number each socket identified by SP: 5775 its own 4-tuple dest IP address DP: 80 Web servers have dest port number S-IP: B different sockets for recv host uses all four D-IP:C each connecting client values to direct SP: 9157 SP: 9157 segment to appropriate non-persistent HTTP may DP: 80 DP: 80 client Client server have different socket for socket IP: A IP:B S-IP: A IP: C S-IP: B each client D-IP:C D-IP:C CSE Department CSE Department 13 14 Transport Layer Transport Layer Connection-oriented demux: Outline Threaded Web Server Transport-layer Connection-oriented services transport: TCP P2 P1 Multiplexing and segment structure P1 P4 P3 5775 9157 9157 80 80 80 demultiplexing reliable data transfer SP: 5775 flow control Connectionless DP: 80 connection management transport: UDP S-IP: B Principles of congestion D-IP:C Principles of reliable control data transfer SP: 9157 SP: 9157 TCP congestion control client DP: 80 DP: 80 Client server IP: A IP:B IP: C S-IP: A S-IP: B D-IP:C D-IP:C CSE Department CSE Department 15 16 Transport Layer Transport Layer UDP: User Datagram Protocol [RFC 768] UDP: more “no frills,” “bare bones” often used for streaming 32 bits Internet transport multimedia apps Why is there a UDP? protocol loss tolerant source port # dest port # no connection Length, in “best effort” service, UDP establishment (which can rate sensitive bytes of UDP length checksum segments may be: segment, add delay) other UDP uses including lost simple: no connection state DNS header delivered out of order at sender, receiver SNMP to app small segment header Application reliable transfer over UDP: connectionless: no congestion control: UDP data ? add reliability at no handshaking between can blast away as fast as (message) application layer UDP sender, receiver desired application-specific each UDP segment error recovery! handled independently UDP segment format of others CSE Department CSE Department 17 18 3
Transport Layer Transport Layer Internet Checksum Example UDP checksum Note Goal: detect “errors” (e.g., flipped bits) in transmitted When adding numbers, a carryout from the segment most significant bit needs to be added to the result Sender: Receiver: Example: add two 16-bit integers treat segment contents compute checksum of as sequence of 16-bit received segment integers check if computed checksum 1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 checksum: addition (1’s equals checksum field value: 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 complement sum) of NO - error detected segment contents wraparound YES - no error detected. 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 sender puts checksum But maybe errors value into UDP checksum sum nonetheless? More later 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0 field …. checksum 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1 Receiver side: checksum + sum of data = 11111….111 CSE Department CSE Department 19 20 Transport Layer Transport Layer Exercise Outline Calculate the checksum of the string Transport-layer Connection-oriented services transport: TCP “ABCDEF”. Multiplexing and segment structure demultiplexing reliable data transfer flow control Connectionless connection management transport: UDP Principles of congestion Principles of reliable control data transfer TCP congestion control CSE Department CSE Department 21 22 Transport Layer Transport Layer Principles of Reliable data transfer Principles of Reliable Data Transfer important in app., transport, link layers important in app., transport, link layers one of most important networking topics! one of most important networking topics! characteristics of unreliable channel will determine characteristics of unreliable channel will determine complexity complexity of reliable data transfer protocol (rdt) of reliable data transfer protocol (rdt) CSE Department CSE Department 23 24 4
Recommend
More recommend