Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction 1-1 Lecture 2 Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012 CS3516: These slides.

Similar presentations


Presentation on theme: "Introduction 1-1 Lecture 2 Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012 CS3516: These slides."— Presentation transcript:

1 Introduction 1-1 Lecture 2 Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012 CS3516: These slides are generated from those made available by the authors of our text.

2 Introduction Lecture 2: outline 1.5 protocol layers, service models 2.7 socket programming with UDP and TCP. 1.3 network core  packet switching, circuit switching, network structure 1-2

3 Introduction Protocol “layers” Networks are complex, with many “pieces”:  hosts  routers  links of various media  applications  protocols  hardware, software Question: is there any hope of organizing structure of network? …. or at least our discussion of networks? 1-3

4 Introduction Organization of air travel  a series of steps ticket (purchase) baggage (check) gates (load) runway takeoff airplane routing ticket (complain) baggage (claim) gates (unload) runway landing airplane routing 1-4

5 Introduction ticket (purchase) baggage (check) gates (load) runway (takeoff) airplane routing departure airport arrival airport intermediate air-traffic control centers airplane routing ticket (complain) baggage (claim gates (unload) runway (land) airplane routing ticket baggage gate takeoff/landing airplane routing Layering of airline functionality layers: each layer implements a service  via its own internal-layer actions  relying on services provided by layer below 1-5

6 Introduction Why layering? dealing with complex systems:  explicit structure allows identification, relationship of complex system’s pieces  layered reference model for discussion  modularization eases maintenance, updating of system  change of implementation of layer’s service transparent to rest of system  e.g., change in gate procedure doesn’t affect rest of system  layering considered harmful? 1-6

7 Introduction Internet protocol stack  application: supporting network applications  FTP, SMTP, HTTP  transport: process-process data transfer  TCP, UDP  network: routing of datagrams from source to destination  IP, routing protocols  link: data transfer between neighboring network elements  Ethernet, 802.111 (WiFi), PPP  physical: bits “on the wire” application transport network link physical 1-7

8 Introduction ISO/OSI reference model  presentation: allow applications to interpret meaning of data, e.g., encryption, compression, machine-specific conventions  session: synchronization, checkpointing, recovery of data exchange  Internet stack “missing” these layers!  these services, if needed, must be implemented in application  needed? application presentation session transport network link physical 1-8

9 Introduction source application transport network link physical HtHt HnHn M segment HtHt datagram destination application transport network link physical HtHt HnHn HlHl M HtHt HnHn M HtHt M M network link physical link physical HtHt HnHn HlHl M HtHt HnHn M HtHt HnHn M HtHt HnHn HlHl M router switch Encapsulation message M HtHt M HnHn frame 1-9

10 Application Layer 2-10 Lecture 2: outline 1.5 protocol layers, service models 2.7 socket programming with UDP and TCP. How does this relate to Project 1? 1.3 network core  packet switching, circuit switching, network structure

11 Application Layer 2-11 Socket programming goal: learn how to build client/server applications that communicate using sockets socket: door between application process and end- end-transport protocol Internet controlled by OS controlled by app developer transport application physical link network process transport application physical link network process socket

12 Application Layer 2-12 Socket programming Two socket types for two transport services:  UDP: unreliable datagram  TCP: reliable, byte stream-oriented Application Example: 1. Client reads a line of characters (data) from its keyboard and sends the data to the server. 2. The server receives the data and converts characters to uppercase. 3. The server sends the modified data to the client. 4. The client receives the modified data and displays the line on its screen.

13 Application Layer 2-13 Socket programming with UDP UDP: no “connection” between client & server  no handshaking before sending data  sender explicitly attaches IP destination address and port # to each packet  rcvr extracts sender IP address and port# from received packet UDP: transmitted data may be lost or received out-of-order Application viewpoint:  UDP provides unreliable transfer of groups of bytes (“datagrams”) between client and server

14 Client/server socket interaction: UDP close clientSocket read datagram from clientSocket create socket: clientSocket = socket(AF_INET,SOCK_DGRAM) Create datagram with server IP and port=x; send datagram via clientSocket create socket, port= x: serverSocket = socket(AF_INET,SOCK_DGRAM) read datagram from serverSocket write reply to serverSocket specifying client address, port number Application 2-14 server (running on serverIP ) client

15 Application Layer 2-15 Example app: UDP client from socket import * serverName = ‘hostname’ serverPort = 12000 clientSocket = socket(socket.AF_INET, socket.SOCK_DGRAM) message = raw_input(’Input lowercase sentence:’) clientSocket.sendto (message,(serverName, serverPort)) modifiedMessage, serverAddress = clientSocket.recvfrom(2048) print modifiedMessage clientSocket.close() Python UDPClient include Python’s socket library create UDP socket for server get user keyboard input Attach server name, port to message; send into socket print out received string and close socket read reply characters from socket into string

16 Application Layer 2-16 Example app: UDP server from socket import * serverPort = 12000 serverSocket = socket(AF_INET, SOCK_DGRAM) serverSocket.bind(('', serverPort)) print “The server is ready to receive” while 1: message, clientAddress = serverSocket.recvfrom(2048) modifiedMessage = message.upper() serverSocket.sendto(modifiedMessage, clientAddress) Python UDPServer create UDP socket bind socket to local port number 12000 loop forever Read from UDP socket into message, getting client’s address (client IP and port) send upper case string back to this client

17 Application Layer 2-17 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 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 that particular client  allows server to talk with multiple clients  source port numbers used to distinguish clients (more in Chap 3) TCP provides reliable, in-order byte-stream transfer (“pipe”) between client and server application viewpoint:

18 Application Layer 2-18 Client/server socket interaction: TCP wait for incoming connection request connectionSocket = serverSocket.accept() create socket, port= x, for incoming request: serverSocket = socket() create socket, connect to hostid, port= x clientSocket = socket() server (running on hostid ) client send request using clientSocket read request from connectionSocket write reply to connectionSocket TCP connection setup close connectionSocket read reply from clientSocket close clientSocket

19 Application Layer 2-19 Example app: TCP client from socket import * serverName = ’servername’ serverPort = 12000 clientSocket = socket(AF_INET, SOCK_STREAM) clientSocket.connect((serverName,serverPort)) sentence = raw_input(‘Input lowercase sentence:’) clientSocket.send(sentence) modifiedSentence = clientSocket.recv(1024) print ‘From Server:’, modifiedSentence clientSocket.close() Python TCPClient create TCP socket for server, remote port 12000 No need to attach server name, port

20 Application Layer 2-20 Example app: TCP server from socket import * serverPort = 12000 serverSocket = socket(AF_INET,SOCK_STREAM) serverSocket.bind((‘’,serverPort)) serverSocket.listen(1) print ‘The server is ready to receive’ while 1: connectionSocket, addr = serverSocket.accept() sentence = connectionSocket.recv(1024) capitalizedSentence = sentence.upper() connectionSocket.send(capitalizedSentence) connectionSocket.close() Python TCPServer create TCP welcoming socket server begins listening for incoming TCP requests loop forever server waits on accept() for incoming requests, new socket created on return read bytes from socket (but not address as in UDP) close connection to this client (but not welcoming socket)

21 Application Layer 2-21 Socket programming Two socket types for two transport services:  UDP: unreliable datagram Connectionless Best effort No checking to see if send was successful  TCP: reliable, byte stream-oriented Connection established before data transfer can begin The network can still garble, lose, or put packets out of order. It’s up to TCP to make it right. Guaranteed successful delivery.

22 Application Layer 2-22 Project 1 Your starter code for Project 1  Project1_thread_example.c  Project1_Starter_Client.c  AddressTranslation.c  Gettysburg.html  Mickey.jpg Use this code for your server. Use this code for your client. Support files.

23 Introduction Lecture 2: roadmap 1.5 protocol layers, service models 2.7 socket programming with UDP and TCP 1.3 network core  packet switching, circuit switching, network structure 1-23

24 Introduction  mesh of interconnected routers  packet-switching: hosts break application-layer messages into packets  forward packets from one router to the next, across links on path from source to destination  each packet transmitted at full link capacity The network core 1-24

25 Introduction Packet-switching: store-and-forward  takes L/R seconds to transmit (push out) L-bit packet into link at R bps  store and forward: entire packet must arrive at router before it can be transmitted on next link one-hop numerical example:  L = 7.5 Mbits  R = 1.5 Mbps  one-hop transmission delay = 5 sec more on delay shortly … 1-25 source R bps destination 1 2 3 L bits per packet R bps  end-end delay = 2L/R (assuming zero propagation delay)

26 Introduction Packet Switching: queueing delay, loss A B C R = 100 Mb/s R = 1.5 Mb/s D E queue of packets waiting for output link 1-26 queuing and loss:  If arrival rate (in bits) to link exceeds transmission rate of link for a period of time:  packets will queue, wait to be transmitted on link  packets can be dropped (lost) if memory (buffer) fills up

27 Network Layer 4-27 Two key network-core functions forwarding : move packets from router’s input to appropriate router output routing: determines source- destination route taken by packets  routing algorithms routing algorithm local forwarding table header value output link 0100 0101 0111 1001 32213221 1 2 3 0111 dest address in arriving packet’s header

28 Introduction Alternative core: circuit switching end-end resources allocated to, reserved for “call” between source & dest:  In diagram, each link has four circuits.  call gets 2 nd circuit in top link and 1 st circuit in right link.  dedicated resources: no sharing  circuit-like (guaranteed) performance  circuit segment idle if not used by call (no sharing)  Commonly used in traditional telephone networks 1-28

29 Introduction Circuit switching: FDM versus TDM FDM frequency time TDM frequency time 4 users Example: 1-29

30 Introduction Packet switching versus circuit switching example:  1 Mb/s link  each user: 100 kb/s when “active” active 10% of time  circuit-switching:  10 users  packet switching:  with 35 users, probability > 10 active at same time is less than.0004 * packet switching allows more users to use network! N users 1 Mbps link Q: what happens if > 35 users ? ….. 1-30 * Check out the online interactive exercises for more examples http://media.pearsoncmg.com/aw/aw_kurose_network_2/applets/transmission/delay.html

31 Introduction  great for bursty data  resource sharing  simpler, no call setup  excessive congestion possible: packet delay and loss  protocols needed for reliable data transfer, congestion control  Q: How to provide circuit-like behavior?  bandwidth guarantees needed for audio/video apps  still an unsolved problem (chapter 7) is packet switching a “slam dunk winner?” Q: human analogies of reserved resources (circuit switching) versus on-demand allocation (packet-switching)? Packet switching versus circuit switching 1-31

32 Internet structure: network of networks  End systems connect to Internet via access ISPs (Internet Service Providers)  Residential, company and university ISPs  Access ISPs in turn must be interconnected.  So that any two hosts can send packets to each other  Resulting network of networks is very complex  Evolution was driven by economics and national policies  Let’s take a stepwise approach to describe current Internet structure

33 Internet structure: network of networks Question: given millions of access ISPs, how to connect them together? access net access net access net access net access net access net access net access net access net access net access net access net access net access net access net access net … … … … … …

34 Internet structure: network of networks Option: connect each access ISP to every other access ISP? access net access net access net access net access net access net access net access net access net access net access net access net access net access net access net access net … … … … … … … … … … … connecting each access ISP to each other directly doesn’t scale: O(N 2 ) connections.

35 Internet structure: network of networks access net access net access net access net access net access net access net access net access net access net access net access net access net access net access net access net … … … … … … Option: connect each access ISP to a global transit ISP? Customer and provider ISPs have economic agreement. global ISP

36 Internet structure: network of networks access net access net access net access net access net access net access net access net access net access net access net access net access net access net access net access net … … … … … … But if one global ISP is viable business, there will be competitors …. ISP B ISP A ISP C

37 Internet structure: network of networks access net access net access net access net access net access net access net access net access net access net access net access net access net access net access net access net … … … … … … But if one global ISP is viable business, there will be competitors …. which must be interconnected ISP B ISP A ISP C IXP peering link Internet exchange point

38 Internet structure: network of networks access net access net access net access net access net access net access net access net access net access net access net access net access net access net access net access net … … … … … … … and regional networks may arise to connect access nets to ISPS ISP B ISP A ISP C IXP regional net

39 Internet structure: network of networks access net access net access net access net access net access net access net access net access net access net access net access net access net access net access net access net … … … … … … … and content provider networks (e.g., Google, Microsoft, Akamai ) may run their own network, to bring services, content close to end users ISP B ISP A ISP B IXP regional net Content provider network

40 Introduction Internet structure: network of networks  at center: small # of well-connected large networks  “tier-1” commercial ISPs (e.g., Level 3, Sprint, AT&T, NTT), national & international coverage  content provider network (e.g, Google): private network that connects it data centers to Internet, often bypassing tier-1, regional ISPs 1-40 access ISP access ISP access ISP access ISP access ISP access ISP access ISP access ISP Regional ISP IXP Tier 1 ISP Google IXP

41 Introduction Tier-1 ISP: e.g., Sprint … to/from customers peering to/from backbone … … … … POP: point-of-presence 1-41


Download ppt "Introduction 1-1 Lecture 2 Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012 CS3516: These slides."

Similar presentations


Ads by Google