Presentation is loading. Please wait.

Presentation is loading. Please wait.

Traditional Internet Applications

Similar presentations


Presentation on theme: "Traditional Internet Applications"— Presentation transcript:

1 Traditional Internet Applications
Chapter 4 Traditional Internet Applications © Bobby Hoggard, Department of Computer Science, East Carolina University These slides may not be used or duplicated without permission

2 Private vs Standard Service
Details needed to create client/server applications The syntax and semantics of messages that can be exchanged Whether the client or server initiates interaction Actions to be taken if an error arises How the two sides know when to terminate communication In defining these details, a programmer is defining an application-layer protocol

3 Private vs Standard Service
Private Service You write both the client and server with the intention that no one else will be writing clients/servers for the service Make up your own rules of how they will communicate No need to write formal documentation on how the interaction works, since no one else needs to understand it Standardized Service Other programmers will be writing client/server applications A set of standards must be published so that apps can communicate correctly together

4 Representation / Transfer
Data Representation Syntax of the data items Form used during transfer Translation of integers (big endian/little endian) Representation of characters (ASCII/Unicode/EBCDIC) Data Transfer Interaction between client and server Syntax of the message Error handling Termination of the interaction

5 Web Protocols HTML URL HTTP HyperText Markup Language
A representation standard used to specify the contents and layout of a web page URL Uniform Resource Locator A representation standard that specifies the format and meaning of web page identifiers HTTP HyperText Transfer Protocol A transfer protocol that specifies how a browser interacts with a web server to transfer data

6 Heading HTML Heading Heading Specifies the syntax for a web page
Scripting language --- not a programming language Specifies what needs to be done --- not how to do it The commands are general guidelines for a browser to follow Example: Headings Heading <H1> Heading </H1> No specification as to how large an H2 heading should be – just that it should be between H1 and H3 Heading <H2> Heading </H2> Heading <H3> Heading </H3>

7 HTML Browser view: <!DOCTYPE html> <html> <head>
<meta charset="utf-8" /> <title>Welcome</title> </head> <body> <p> <strong>Hello</strong> world! </p> </body> </html> Browser view: Head contains: title meta tags (provides info about the document) links to CSS documents & embedded CSS styles links to import JavaScript & embedded scripts <!DOCTYPE html> this file is using HTML 5 <meta charset="utf-8" /> this file is using Unicode

8 URL Identifies the location of a web item (page, graphic, sound file, etc.) Format: Protocol :// ComputerName : Port / DocumentName ? Parameters The protocol to use for transfer Ex: HTTP, HTTPS, FTP IP Address or Domain Name Port where server is listening Name of the file to retrieve Parameters supplied to an executing function

9 URL Examples Visit ECU's web page www.ecu.edu
http :// : 80 / default.html Default protocol is HTTP Default port is 80 Usually: default.html or index.html This is decided by the server

10 URL Examples Search YAHOO for the word "computers"
https :// search.yahoo.com / search ? p=computers Asking for an encrypted transfer protocol Default port is 80 The name of their search function to execute The function requires a parameter named p and we're giving it a value of computers

11 HTTP Specifies how to handle the data transfer between the server and browser Four key points: Uses stream transfer Uses text-based control messages Transfers binary data files Can download or upload data Incorporates caching

12 HTTP Once a connection is established, the browser sends a request to the server Four major request types: Request Description Response GET Requests an item from the server Server sends a header and a copy of the item HEAD Requests an item's header from the server Server sends a header POST Sends data to the server Server appends the data to a specified item PUT Server uses the data to replace the specified item

13 The URL for the requested item
HTTP Example Use GET to retrieve a web page from a web server Format: GET / item Version CR LF The URL for the requested item Usually version 1.0 or 1.1 The ASCII carriage return and line feed characters. Specifies the end of of the line

14 HTTP Example Visit the class website Browser Request: Server Response:
GET HTTP/1.1 CR LF Server Response: HTTP/ OK Cache-Control: private Content-Type: text/html; charset=utf-8 Server: Microsoft-IIS/7.0 X-AspNet-Version: X-Powered-By: ASP.NET Date: Sun, 27 Jan :48:57 GMT Content-Length: 5039 <!DOCTYPE html> <html xmlns=" <head><title> ... Header Section Content Section

15 Server Response Header Section contains: Status code HTTP version
200 = OK (no problems encountered) 404 = Item not found HTTP version Server type Date the item was last modified Length of the content (in bytes) Type of the item, examples: text/HTML text/plain text image/JPEG Header Section HEAD CR LF GET Content Section

16 HTTP POST vs PUT PUT is often used when you know the exact location of the item to be updated POST is often used when you don't know the exact location, and thus you let the server handle putting the data where it belongs Notice the exact location (including article number) Just specifies an address of "articles", but no specific number

17 Browser Caching Reduces download times
Saves a copy of each server item requested onto the user’s disk Purpose is to use the cached copies instead of constantly redownloading the same items over and over again Note that it is possible to specify that an item should not be cached Algorithm: if (item is not in local cache) { issue a GET command to retrieve the item store a copy in local cache } else { issue a HEAD command to server if (date modified in header > date modified in cache copy) issue a GET command to retrieve the updated item store updated item in local cache use the cached copy

18 Browser Architecture Browsers are generally very complex They have to:
output to display Browsers are generally very complex They have to: Interact with the user Interact with a server Understand various protocols and languages Format and display pages driver input from keyboard/ mouse controller HTML interpreter CSS interpreter HTTP client FTP client JavaScript interpreter network interface network connection

19 FTP Transfers binary or text files between two devices Key points:
Uses stream transfer Uses text-based control messages Can transfer any type of file (documents, images, music, video, executables, etc.) Can download or upload data Supports authentication and ownership (files can have owners and access restrictions) Can browse folders (clients can obtain the contents of a directory) Hides details of individual computer operating systems

20 CARRIAGE RETURN + LINEFEED characters
FTP Hides details of individual computer operating systems Filename differences .HTM / .JPG .HTML / .JPEG End of line LINEFEED character CARRIAGE RETURN + LINEFEED characters Directory separators / \ Users User "X" Different User "X"

21 FTP Uses TWO ports… server default port 21 for control messages and port 20 for the data transfer Active FTP Server Client Port 21 Random port Port 20 Client connects to the server for control messages Server connects to the client for data transfer (meaning the client temporarily acts like a server) Passive FTP Server Client Port 21 Random port Client connects to the server for control messages Client connects to the server for data transfer

22 Active FTP Example Server Client client forms a control connection to the server client sends a request for directory listing server forms a data connection to the client server sends directory listing server closes the data connection Connect to an FTP server, get a list of files and then retrieve one of them client sends request to download file server forms a data connection to the client server sends the requested file server closes the data connection Key: client sends a QUIT command to server control client closes the control connection data

23 Which Port? Server Client 21 client forms control connection random 20
server forms data connection random

24 Get File From Server Server Client
client sends RETR message (request for file) choose a local port X BIND local port LISTEN for incoming wait to ACCEPT connection client sends PORT X message server CONNECTs to client on port X server SENDs requested file server closes the data connection

25 NAT (Network Address Translation)
Active FTP can fail if the client computer is behind a NAT device Public Internet Private Network To From To From NAT Client Server To From To From


Download ppt "Traditional Internet Applications"

Similar presentations


Ads by Google