Presentation is loading. Please wait.

Presentation is loading. Please wait.

PART 6 Application Layer

Similar presentations


Presentation on theme: "PART 6 Application Layer"— Presentation transcript:

1 PART 6 Application Layer

2 Position of Application Layer

3 Role of Application Layer
Enables the user, whether human or software, to access the network Provides user interfaces and support for services such as electronic mail, remote file access and transfer, and access to the World Wide Web

4 General Issues of Application Layer
Client-server Paradigm

5 General Issues of Application Layer
Addressing address address to access a web page Types of Service Application layer is designed to give different services to the user or user programs. SMTP FTP WWW HTTP

6 Chapter 27 HTTP and WWW

7 27.1 HTTP HTTP is used mainly to access data on the WWW
The protocol transfers data in the form of plain text, hypertext, audio, video, and so on. HTTP functions like a combination of FTP and SMTP. HTTP is much simpler than FTP because it uses only one TCP connection (well-known port 80) HTTP is like SMTP because the data transferred between the client and the server are similar to SMTP messages. SMTP messages are stored and forward, but HTTP messages are delivered immediately HTTP uses the services of TCP on well-known port 80

8 About SMTP Architecture of Simple Mail Transfer Protocol (SMTP)

9 HTTP (cont’d) The request and response messages carry data in the form of a letter with a MIME-like format. letter-like request and letter-like response messages * MIME :Multipurpose Internet Mail Extensions Transaction HTTP is stateless protocol; Each time you need something from the server, your client (browser) makes a connection, gets that file, and then the connection is closed. The client initializes the transaction by sending a request message. The sever replies by sending a response.

10 HTTP (cont’d) HTTP Transaction

11 HTTP (cont’d) Request Messages

12 HTTP (cont’d) Request line
Request type : categorizing the request messages into several methods URL defines four things : method, host computer, port and path

13 HTTP (cont’d) The method is the protocol used to retrieve the document
ex) FTP, HTTP The host is the computer where the information is located The port number of the server is optional. Path is the path name of the file where the information is located. Version of HTTP

14 HTTP (cont’d) Methods GET, HEAD, POST, PUSH, etc. Response Message

15 HTTP (cont’d) Status line
Status code field is similar to those in the FTP and the SMTP Status phrase : explain the status code in text form

16 HTTP (cont’d) Headers Header format

17 HTTP (cont’d) General Header : gives general information about the messages Request Header : specifies the server’s configuration and special information about the request Response Header : specifies the server’s configuration and special information about the request Entity Header : gives information about the body of the document

18 Example 1 This example retrieves a document. We use the GET method to retrieve an image with the path /usr/bin/image1. The request line shows the method (GET), the URL, and the HTTP version (1.1). The header has two lines that show that the client can accept images in GIF and JPEG format. The request does not have a body. The response message contains the status line and four lines of header. The header lines define the date, server, MIME version, and length of the document. The body of the document follows the header (see Fig. 27.9, next slide).

19 Example 1 (cont’d)

20 Example 2 This example retrieves information about a document. We use the HEAD method to retrieve information about an HTML document (see the next section). The request line shows the method (HEAD), URL, and HTTP version (1.1). The header is one line showing that the client can accept the document in any format (wild card). The request does not have a body. The response message contains the status line and five lines of header. The header lines define the date, server, MIME version, type of document, and length of the document (see Fig , next slide). Note that the response message does not contain a body

21 Example 2 (cont’d)

22 HTTP (cont’d) – Some Other Features
Nonpersistent Connection The client opens a TCP connection The server sends the response and closes the connection The client reads the data until it encounters an end-of-file marker Persistent connection The server leaves the connection open for more request after sending a response HTTP version 1.1 specifies a persistent connection by default.

23 HTTP (cont’d) Proxy server HTTP supports proxy servers
A proxy server is a computer that keeps copies of response to recent requests Reducing the load on the original sever, decreasing traffic, and improving latency

24 World Wide Web (WWW) A repository of information spread all over the world and linked together. The WWW project was initiated by CERN (European Laboratory for Particle Physics) to create a system to handle distributed resources necessary for scientific research. The WWW today is a distributed client-sever service, in which a client using a browser can access a service using a server

25 WWW (cont’d) The service provided is distributed over many locations called websites. Distributed Services

26 WWW (cont’d) Hypertext Hypermedia documents
- including pictures, graphics and sound

27 WWW (cont’d) Browser architecture

28 WWW (cont’d) Categories of Web documents
Static documents are fixed-content document that are created and stored in a server. The contents in the server can be changed, but the user cannot change it.

29 WWW (cont’d) Static document

30 WWW (cont’d) HTML (Hypertext Markup Language)
- is a language for creating Web services

31 WWW (cont’d) Effect of boldface tags

32 WWW (cont’d) Beginning and ending tag = =

33 WWW (cont’d) Common tags Beginning Tag Ending Tag Meaning
Skeletal Tags <HTML> </HTML> Defines an HTML document <HEAD> </HEAD> Defines the head of the document <BODY> </BODY> Defines the body of the document Title and Header Tags <TITLE> </TITLE> Defines the title of the document <Hn> </Hn>

34 WWW (cont’d) Common tags Beginning Tag Ending Tag Meaning
Text Formatting Tags <B> </B> Boldface <I> </I> Italic <U> </U> Underlined <SUB> </SUB> Subscript <SUP> </SUP> Superscript Data Flow Tag <CENTER> </CENTER> Centered <BR> </BR> Line break

35 WWW (cont’d) Beginning Tag Ending Tag Meaning List Tags <OL>
Ordered list <UL> </UL> Unordered list <LI> </LI> An item in a list Image Tag <IMG> Defines an image Hyperlink Tag <A> </A> Defines an address (hyperlink) Executable Contents <APPLET> </APPLET> The document is an applet

36 Example 3 This example shows how tags are used to let the browser format the appearance of the text <HTML> <HEAD> <TITLE> First Sample Document </TITLE> </HEAD> <BODY> <CENTER> <H1><B> ATTENTION </B></H1> </CENTER> You can get a copy of this document by: <UL> <LI> Writing to the publisher <LI> Ordering online <LI> Ordering through a bookstore </UL> </BODY> </HTML>

37 Example 4 This example shows how tags are used to import an image and insert it into the text <HTML> <HEAD> <TITLE> Second Sample Document </TITLE> </HEAD> <BODY> This is the picture of a book: <IMG SRC="Pictures/book1.gif" ALIGN=MIDDLE> </BODY> </HTML>

38 Example 5 This example shows how tags are used to make a hyperlink to another document. <HTML> <HEAD> <TITLE> Third Sample Document </TITLE> </HEAD> <BODY> This is a wonderful product that can save you money and time. To get information about the producer, click on <A HREF=" Producer </A> </BODY> </HTML>

39 WWW (cont’d) Dynamic document does not exist in a predefined format.
is created by a Web server whenever a browser requests the document.

40 WWW (cont’d) Common Gateway Interface
is a technology that creates and handles dynamic documents CGI program ~ is code written in one the languages supporting CGI

41 WWW (cont’d) Example 6 is a CGI program written in Bourne shell script. The program accesses the UNIX utility (date) that returns the date and the time. Note that the program output is in plain text. #!/bin/sh # The head of the program echo Content_type: text/plain echo # The body of the program now='date' echo $now exit 0

42 Example 7 Example 7 is similar to Example 6 except that program output is in HTML. #!/bin/sh # The head of the program echo Content_type: text/html echo # The body of the program echo <HTML> echo <HEAD><TITLE> Date and Time </TITLE></HEAD> echo <BODY> now='date' echo <CENTER><B> $now </B></CENTER> echo </BODY> echo </HTML> exit 0

43 Example 8 Example 8 is similar to Example 7 except that the program is written in Perl. #!/bin/perl # The head of the program print "Content_type: text/html\n"; print "\n"; # The body of the program print "<HTML>\n"; print "<HEAD><TITLE> Date and Time </TITLE></HEAD>\n"; print "<BODY>\n"; $now = 'date'; print "<CENTER><B> $now </B></CENTER>\n"; print "</BODY>\n"; print "</HTML>\n"; exit 0

44 WWW (cont’d) Active Documents
For many applications, we need a program to be run at the client site. These are called active documents

45 WWW (cont’d) Creation and compilation

46 Thanks !


Download ppt "PART 6 Application Layer"

Similar presentations


Ads by Google