3rd Edition: Chapter 2

Apache Web. server .... Server: Apache/2.0.52 (CentOS)\r\n ...... e.g., key = hash(“Led Zeppelin IV”); this is why its is referred to as a distributed “hash” table.
展开查看详情

1.Application Layer 2- 1 Chapter 2 Application Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012 A note on the use of these ppt slides: We ’ re making these slides freely available to all (faculty, students, readers). They ’ re in PowerPoint form so you see the animations; and can add, modify, and delete slides (including this one) and slide content to suit your needs. They obviously represent a lot of work on our part. In return for use, we only ask the following: If you use these slides (e.g., in a class) that you mention their source (after all, we ’ d like people to use our book!) If you post any slides on a www site, that you note that they are adapted from (or perhaps identical to) our slides, and note our copyright of this material. Thanks and enjoy! JFK/KWR All material copyright 1996-2012 J.F Kurose and K.W. Ross, All Rights Reserved

2.Chapter 2: outline 2.1 principles of network applications 2.2 Web and HTTP 2.3 FTP 2.4 electronic mail SMTP, POP3, IMAP 2.5 DNS 2.6 P2P applications 2.7 socket programming with UDP and TCP Application Layer 2- 2

3.principles of network applications Application Layer 2- 3

4.Chapter 2: application layer our goals: conceptual, implementation aspects of network application protocols transport-layer service models client-server paradigm peer-to-peer paradigm learn about protocols by examining popular application-level protocols HTTP FTP SMTP / POP3 / IMAP DNS creating network applications socket API Application Layer 2- 4

5.Some network apps e-mail web text messaging remote login P2P file sharing multi-user network games streaming stored video (YouTube, Hulu, Netflix) voice over IP (e.g., Skype) real-time video conferencing social networking search … … Application Layer 2- 5

6.Application Layer 2- 6 Creating a network app write programs that: run on (different) end systems communicate over network e.g., web server software communicates with browser software no need to write software for network-core devices network-core devices do not run user applications applications on end systems allows for rapid app development, propagation application transport network data link physical application transport network data link physical application transport network data link physical

7.Application architectures possible structure of applications: client-server peer-to-peer (P2P) Hybrid of client-server and P2P Application Layer 2- 7

8.Client-server architecture server: always-on host permanent IP address data centers for scaling clients: communicate with server may be intermittently connected may have dynamic IP addresses do not communicate directly with each other Application Layer 2- 8 client/server

9.P2P architecture no always-on server arbitrary end systems directly communicate peers request service from other peers, provide service in return to other peers self scalability – new peers bring new service capacity, as well as new service demands peers are intermittently connected and change IP addresses complex management Application Layer 2- 9 peer-peer

10.Hybrid of Client-Server and P2P Skype voice-over-IP P2P application centralized server : finding address of remote party: client-client connection : direct (not through server) Instant Messaging chatting between two users is P2P centralized service : client presence detection/location user registers its IP address with central server when it comes online user contacts central server to find IP addresses of buddies Application Layer 2- 10 peer-peer

11.Processes communicating process: program running within a host within same host, two processes communicate using inter-process communication (IPC) (defined by OS) processes in different hosts communicate by exchanging messages client process: process that initiates communication server process: process that waits to be contacted Application Layer 2- 11 aside: applications with P2P architectures have client processes & server processes clients, servers

12.Sockets process sends/receives messages to/from its socket socket analogous to door sending process shoves message out door sending process relies on transport infrastructure on other side of door to deliver message to socket at receiving process Application Layer 2- 12 Internet controlled by OS controlled by app developer transport application physical link network process transport application physical link network process socket

13.Addressing processes identifier includes both IP address and port numbers associated with process on host. example port numbers: HTTP server: 80 mail server: 25 to send HTTP message to gaia.cs.umass.edu web server: IP address: 128.119.245.12 port number: 80 more shortly… to receive messages, process must have identifier host device has unique 32-bit IP address Q: does IP address of host on which process runs suffice for identifying the process? Application Layer 2- 13 A: no, many processes can be running on same host

14.App-layer protocol defines types of messages exchanged, e.g., request, response message syntax: what fields in messages & how fields are delineated message semantics meaning of information in fields rules for when and how processes send & respond to messages open protocols: defined in RFCs allows for interoperability e.g., HTTP, SMTP proprietary protocols: e.g., Skype Application Layer 2- 14

15.What transport service does an app need? data integrity some apps (e.g., file transfer, web transactions) require 100% reliable data transfer other apps (e.g., audio) can tolerate some loss timing some apps (e.g., Internet telephony, interactive games) require low delay to be “ effective ” Application Layer 2- 15 throughput some apps (e.g., multimedia) require minimum amount of throughput to be “ effective ” other apps ( “ elastic ( مرن ) apps ” ) make use of whatever throughput they get security encryption, data integrity, …

16.Transport service requirements: common apps Application Layer 2- 16 application file transfer e-mail Web documents real-time audio/video stored audio/video interactive games text messaging data loss no loss no loss no loss loss-tolerant loss-tolerant loss-tolerant no loss throughput elastic ( مرن ) elastic elastic audio: 5kbps-1Mbps video:10kbps-5Mbps same as above few kbps up elastic time sensitive no no no yes, 100 ’ s msec yes, few secs yes, 100 ’ s msec yes and no

17.Internet transport protocols services TCP service: reliable transport between sending and receiving process flow control: sender won ’ t overwhelm receiver Congestion ( احتقان ) control: throttle ( خنق ) sender when network overloaded does not provide: timing, minimum throughput guarantee, security connection-oriented: setup required between client and server processes UDP service: unreliable data transfer between sending and receiving process does not provide: reliability, flow control, congestion control, timing, throughput guarantee, security, or connection setup Q: why bother? Why is there a UDP? Application Layer 2- 17

18.Internet apps: application, transport protocols Application Layer 2- 18 application e-mail remote terminal access Web file transfer streaming multimedia Internet telephony application layer protocol SMTP [RFC 2821] Telnet [RFC 854] HTTP [RFC 2616] FTP [RFC 959] HTTP (e.g., YouTube), RTP [RFC 1889] SIP, RTP, proprietary (e.g., Skype) underlying transport protocol TCP TCP TCP TCP TCP or UDP TCP or UDP

19.Securing TCP TCP & UDP no encryption cleartext passwds sent into socket traverse Internet in cleartext TLS (Transport Layer Security) / SSL ( Secure Sockets Layer ) provides encrypted TCP connection data integrity end-point authentication TLS / SSL is at app layer Apps use SSL libraries, which “ talk ” to TCP TLS / SSL socket API cleartext passwds sent into socket traverse Internet encrypted See Chapter 7 Application Layer 2- 19

20.Network Applications/1 Most Net Applications use the Client-Server architecture, in which two processes (applications) communicate with each other to exchange some information. One of the two processes acts as a client process, and the other one acts as a server Client Process This process typically makes a request for information. After getting the response, it may terminate or may do some other processing. Example: Internet Browser works as a client application, which sends a request to the Web Server to get one HTML webpage. Application Layer 2- 20

21.Network Applications/2 Server Process This process takes a request from clients. When it gets a request from a client, the server process will perform the required processing, gather the requested information, and send it to the requestor client. o nce done, it becomes ready to serve another client. Server processes are always alert and ready to serve incoming requests. Application Layer 2- 21

22.Network Applications/3 Example : Web Server keeps waiting for requests from Internet Browsers and A s soon as it gets any request from a browser, it picks up a requested HTML page and sends it back to that Browser. Note that: A client needs to know the address of the server (IP and Port), but T he server does not need to know the address or even the existence of the client prior to the connection being established/requested. Once a connection is established, both sides (client & server know about each others) and can send and receive information back and forth between them. Application Layer 2- 22

23.2 -Tier vs. 3 -Tier Architectures/1 There are two types of Client-Server Architectures 2-Tier Architecture The client directly interacts with the server. This may have some security holes and performance problems. For example: Internet Explorer and Web Server work on two-tier architecture. Here security problems are resolved using Secure Socket Layer (SSL) or its new version the Transport Layer Security (TLS) i.e. HTTPS uses port # 443 ( also called HTTP over TLS , HTTP over SSL , or HTTP Secure ) Application Layer 2- 23

24.2 -Tier vs. 3 -Tier Architectures/2 There are two types of Client-Server Architectures 3-Tier Architecture In this architecture, one more software sits in between the client and the server. This middle software is called ‘ middleware ’. Middleware are used to perform all the security checks and load balancing in case of heavy load. A middleware takes all requests from the client and after performing the required authentication, it passes that request to the server. Then the server does the required processing and sends the response back to the middleware and finally the middleware passes this response back to the client. If you want to implement a 3-tier architecture, then you can keep any middleware like Web Logic or WebSphere software in between your Web Server and Web Browser . Application Layer 2- 24

25.Simply: Two Types of Servers Iterative Server: This is the simplest form where a server process serves one client at a time and after completing the first request, it takes request from another client. Meanwhile , other clients keep waiting  Concurrent Servers: In this type, a server runs multiple concurrent processes to serve many requests at a time because one process may take longer and another client cannot wait for so long. The simplest way to write a concurrent server under Unix is to fork() a child process to handle each client separately ( use threads when using Java and C# ) Application Layer 2- 25

26.How to Make a Client The System Calls/APIs for establishing a connection are somewhat different for a client and server, B ut both involve the construct of a Socket Each (client and server) has to establish its own S ocket The steps involved in establishing a socket on the client side are as follows: Create a socket with the socket() system call. Connect the socket to the address of the server using the connect() system call. Then your client is ready to send and receive data. There are a number of ways to do this, but the simplest way is to use the read() and write() system calls. Application Layer 2- 26

27.How to Make a Server The steps involved in establishing a socket on the server side are as follows: Create a socket with the socket() system call. Bind the socket to an address using the bind() system call. For a server socket on the Internet, an address consists of a port number on the host machine . Listen for connections with the listen() system call. Accept a connection with the accept() system call. This call typically blocks the connection until a client connects with the server. Then your server is ready to send and receive data. The simplest way is using the read() and write() system calls . Hmmm O f course, this would be true if you are using C and Unix . (I think you are preferring Java and/or C# )  Application Layer 2- 27

28.Application Layer 2- 28

29.Application Layer 2- 28