Presentation is loading. Please wait.

Presentation is loading. Please wait.

NWEN 243 Networked Applications Lecture 12: Layer 4 – Transport NWEN 243 © , Kris Bubendorfer.

Similar presentations


Presentation on theme: "NWEN 243 Networked Applications Lecture 12: Layer 4 – Transport NWEN 243 © , Kris Bubendorfer."— Presentation transcript:

1 NWEN 243 Networked Applications Lecture 12: Layer 4 – Transport NWEN 243 © 2011-15, Kris Bubendorfer

2 Layer 4 We have talked about layers 1-3 At Layer 2 we looked a little at the Ethernet Protocol. At layer 3 we looked at the IP protocol. Layer 4 (today’s lecture) is an end-to-end transport, namely the UDP and TCP protocols. Great, but first, what IS a protocol. NWEN 243 © 2011-15, Kris Bubendorfer

3 Protocol Overview Defines acceptable behaviour: Agreed data format Handshake Message Response Occur at many levels Definition: A protocol defines the format and the order of messages exchanged between two or more communicating entities, as well as the actions taken on the transmission and/or receipt of a message or other event. NWEN 243 © 2011-15, Kris Bubendorfer

4 Protocols - Phone Circa Theatre Do you have 2 seats for “A View from the Bridge”? yes In the front? yes How much for a Student? $38 each Here is my Visa Card no. Ok, your tickets can be picked up. Thank you. Goodbye. NWEN 243 © 2011-15, Kris Bubendorfer

5 Protocols – Scalpers Unlimited Do you have 2 seats for “A View from the Bridge”? yes In the front? yes How much for a student? $150 each You must be Joking! It’s a competitive price No Thanks Goodbye. NWEN 243 © 2011-15, Kris Bubendorfer

6 Protocols - Email HELO “vivamexico.ecs.vuw.ac.nz” 250 OK MAIL FROM: 250 OK RCPT TO: 250 OK DATA 354 Start mail input; end with. Blah, blah, blah NWEN 243 © 2011-15, Kris Bubendorfer

7 The Transport Layer transport protocol applications technology An ‘hourglass’ protocol NWEN 243 © 2011-15, Kris Bubendorfer

8 Layers = Abstraction Networks are complex with many “pieces”: ◦ hosts ◦ routers ◦ links of various media ◦ applications ◦ protocols ◦ hardware, software Managing complexity is what abstraction is for. NWEN 243 © 2011-15, Kris Bubendorfer

9 Organisation of air travel: Service View Airtravel is a complex system. ◦ It involves ticketing agents, baggage handlers, gate personal, pilots, planes, air traffic control, routing, customs etc. ◦ One way to deal with this complexity is to break the process down into small steps. ◦ Analogy to communications, shipped from A to B. NWEN 243 © 2011-15, Kris Bubendorfer

10 Organisation of air travel ticket (purchase) baggage (check) gates (load) runway takeoff airplane routing ticket (complain) baggage (claim) gates (unload) runway landing airplane routing NWEN 243 © 2011-15, Kris Bubendorfer

11 Organisation of air travel II Layers: each layer implements a service ◦ via its own internal-layer actions ◦ relies on services provided by layer below ticket (purchase) baggage (check) gates (load) runway takeoff airplane routing ticket (complain) baggage (claim) gates (unload) runway landing airplane routing NWEN 243 © 2011-15, Kris Bubendorfer

12 Layered air travel: services Counter-to-counter delivery of person & bags baggage-check-to-baggage-claim delivery people transfer: loading gate to arrival gate runway-to-runway delivery of plane airplane routing from source to destination NWEN 243 © 2011-15, Kris Bubendorfer

13 Distributed layer functionality ticket (purchase) baggage (check) gates (load) runway takeoff airplane routing Departing airport ticket (complain) baggage (claim) gates (unload) runway landing airplane routing Arriving airport airplane routing Intermediate air traffic sites airplane routing NWEN 243 © 2011-15, Kris Bubendorfer

14 Why layering? Dealing with complex systems: ◦ explicit structure allows identification, relationship of complex system’s pieces ◦ modularity eases maintenance, updating of system ◦ change of implementation of a layer is transparent to rest of system  e.g., change in gate procedure doesn’t affect rest of system NWEN 243 © 2011-15, Kris Bubendorfer

15 TCP/IP Layer Model LayerFunction Host Layers 4. ApplicationNetworked Application 3. TransportHost-Host Media Layers 2. NetworkRouting & Addressing 1. Net AccessEthernet etc… NWEN 243 © 2011-15, Kris Bubendorfer LayerFunction Host Layers 7. ApplicationNetworked Application 6. PresentationData representation and encryption. 5. SessionState 4. TransportHost-Host Media Layers 3. NetworkRouting & Addressing 2. Data LinkPoint to Point Protocol (e.g. PPP) 1. PhysicalMedia and Signal TCP/IP OSI

16 Layers: Logical Communication Each Layer distributed “entities” implement layer functions at each node entities perform actions, exchange messages with peers transport network application Media Access physical transport network application Media Access physical transport network application Media Access physical transport network application Media Access physical network Media Access physical NWEN 243 © 2011-15, Kris Bubendorfer

17 Layers: Logical Communication E.g. transport take data from app add addressing, reliability check info to form “datagram” send datagram to peer wait for peer to ack receipt analogy: post office. your grandmother’s birthday card. transport network application Media Access physical transport network application Media Access physical transport network application Media Access physical transport network application Media Access physical network Media Access physical data transport data ack NWEN 243 © 2011-15, Kris Bubendorfer

18 Layers: Physical Communication transport network application Media Access physical transport network application Media Access physical transport network application Media Access physical transport network application Media Access physical network Media Access physical data NWEN 243 © 2011-15, Kris Bubendorfer

19 Transport layer port numbers How can ensure it is delivered to the right application on that machine? We need to be able to address the applications on a machine, just like we had to address the machines themselves. We use port numbers. NWEN 243 © 2011-15, Kris Bubendorfer IP: 192.168.0.1 Port: 3000

20 Layer 4 – the Transport Layer. The network layer performs machine to machine delivery of datagrams The transport layer performs application to application delivery. Ports are (16 bit) numbers (like house numbers) that form the address space of a protocol. ◦ i.e. you can have tcp/53 and udp/53. A socket is a software structure associated with a port. An application must ‘bind’ (associate) a socket to a port before it can be used. The Socket API is the interface for applications to gain access to the network. 42 Hitchhiker’s St is a different house from 42 Thanks for all the fish St. NWEN 243 © 2011-15, Kris Bubendorfer

21 Socket API Client/server paradigm Two levels of service in the socket API: ◦ User Datagram Protocol (UDP)  Best effort protocol, transmits datagrams. ◦ Transmission Control Protocol (TCP)  reliable, byte stream-oriented, with capacity control, transmits segments. NWEN 243 © 2011-15, Kris Bubendorfer

22 Sockets Socket: a door between application process and end-end-transport protocol (UCP or TCP) UDP service: unreliable connectionless transfer of datagrams from one process to another TCP service: reliable transfer of bytes (carried in segments) from one process to another over a connection. process Buffers, variables socket controlled by application developer controlled by operating system host or server process Buffers, variables socket controlled by application developer controlled by operating system host or server NWEN 243 © 2011-15, Kris Bubendorfer Internet

23 Socket programming with UDP UDP no “connection” between client and server, each datagram is an independent item. no handshaking client explicitly attaches IP address and port of destination server must extract IP address, port of sender from received datagram UDP transmitted data may be received out of order, or lost Application view UDP provides unreliable transfer of groups of bytes (“datagrams”) between client and server From: To: NWEN 243 © 2011-15, Kris Bubendorfer

24 UDP Socket Structure Client process Server process server socket client socket response request NWEN 243 © 2011-15, Kris Bubendorfer

25 Socket programming with TCP Client must contact server server process must first be running server must have created socket (door) that welcomes client’s contact Client contacts server by: creating client-local TCP socket specifying IP address, port number of server process When client creates socket: client TCP establishes connection to server TCP When contacted by client, server TCP creates new socket for server process to communicate with client ◦ allows server to talk with multiple clients TCP provides reliable, in-order transfer of bytes (a “pipe”) between client and server Application viewpoint NWEN 243 © 2011-15, Kris Bubendorfer

26 TCP Socket Structure Client process Client process Server process Server process “public” socket “connection” socket client socket 3-way handshake stream data NWEN 243 © 2011-15, Kris Bubendorfer

27 TCP Steps Server (on hostId) Create public socket with port = x Wait for connection create connection socket Read request from connection socket Write reply to connection socket Client Create socket Connect to hostId, port x Send request on client socket Read reply from client socket Close client socket NWEN 243 © 2011-15, Kris Bubendorfer

28 Sockets and Ports IP (network layer) receives all datagrams for host IP delivers to appropriate transport layer (protocol) Transport protocol delivers to socket (application) IP application

29 TCP Ports and Sockets - Detail Server listens on a socket for a connection Connect request causes new socket on same port Server uses new thread to service connection TCP listener thread server socket port socket worker

30 Fin. NWEN 243 © 2011-15, Kris Bubendorfer


Download ppt "NWEN 243 Networked Applications Lecture 12: Layer 4 – Transport NWEN 243 © , Kris Bubendorfer."

Similar presentations


Ads by Google