DOC PREVIEW
UCLA COMSCI 118 - week2

This preview shows page 1-2-3-4-5 out of 15 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Chapter 2: Application layer!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 TCP!2.8 Socket programming with UDP!" Next week!Not covered in lecture!CS118!1!Some network applications!# e-mail!# web!# instant messaging!# remote login!# P2P file sharing!# multi-user network games!# streaming stored video (YouTube)!# voice over IP!# real-time video conferencing!application transport network data link physical application transport network data link physical application transport network data link physical Application processes communicate with!each other using application protocols!CS118!2!Client-server application communication model!servers: !# Reachable by global IP address!# always-on host, waiting for incoming requests!clients:!# Initiate communication with server!client/server Q: How does a client process “identify” the server process with which it wants to communicate?!A: Using port numbers via the socket API!CS118!3!IP address, TCP connection, port number, processes, and sockets!CS118!4!Operating system (including TCP, IP) email server process port=25 web server process port=80 IP address: 131.179.128.19 web browser process port=2345 12.2.3.4 Apple Mail process Port=4567 18.2.3.4HTTP: HyperText Transfer Protocol!# Web’s application layer protocol!# client/server model!# Uses TCP!! client initiates TCP connection (creates socket) to server, port 80!# Stateless: server processes each HTTP request independently, does not keep information about past requests!# HTTP/1.0: non-persistent connection!# HTTP/1.1: persistent connection!! May also pipelining!CS118!5!PC running!Explorer!Server running Apache Web server Mac running!Safari!Plan for Tuesday!# HTTP message format!! and a little fun: how to manually generate a HTTP request!# HTTP cookies!! How it works!# HTTP caching!# File Transfer Protocol (FTP): What we used before web!! Similarities and differences!CS118!6!HTTP request message!# two types of HTTP messages: request, response!# HTTP request message:!! ASCII (human-readable)!CS118!7!GET /index.html HTTP/1.1\r\n Host: www-net.cs.umass.edu\r\n User-Agent: Firefox/3.6.10\r\n Accept: text/html,application/xhtml+xml\r\n Accept-Language: en-us,en;q=0.5\r\n Accept-Encoding: gzip,deflate\r\n Accept-Charset: ISO-8859-1,utf-8;q=0.7\r\n Keep-Alive: 115\r\n Connection: keep-alive\r\n \r\n request line header lines A blank line indicates end of header Optional message body method URL version carriage return character!line-feed character!Method types!HTTP/1.0!# GET!# POST!# HEAD!! Requesting the header only (i.e. response does not include the requested object)!HTTP/1.1!# GET, POST, HEAD!# PUT!! uploads file in entity body to path specified in URL field!# DELETE!! deletes file specified in the URL field from the server!# and a few others!! See the protocol specification RFC2616!CS118!8!FYI: the difference between POST and PUT!is reflected in the different meaning of the Request-URL. !# The URL in a POST request identifies the resource that will handle the enclosed entity. That resource may be a data-accepting process, a gateway to some other protocol, or a separate entity that accepts annotations.!# In contrast, the URL in a PUT request identifies the entity enclosed with the request -- the user agent knows what URL is intended and the server MUST NOT attempt to apply the request to some other resource.!CS118!9!HTTP response message!CS118!10!HTTP/1.1 200 OK\r\n Date: Sun, 26 Sep 2010 20:09:20 GMT\r\n Server: Apache/2.0.52 (CentOS)\r\n Last-Modified: Tue, 30 Oct 2007 17:00:02 GMT\r\n ETag: "17dc6-a5c-bf716880"\r\n Accept-Ranges: bytes\r\n Content-Length: 2652\r\n Keep-Alive: timeout=10, max=100\r\n Connection: Keep-Alive\r\n Content-Type: text/html; charset=ISO-8859-1\r\n \r\n data data data data data ... status line (status code, status phrase) header lines data, e.g., !requested!HTML file!A blank line!HTTP response status codes!# Appears in the first line in server!client response message:!# A few sample codes:!200 OK!! request succeeded, requested object later in this message!301 Moved Permanently!! requested object moved, new location specified later in this message (Location:)!400 Bad Request!! request message not understood by server!404 Not Found!! requested document not found on this server!505 HTTP Version Not Supported!CS118!11!Trying out HTTP (client side) for yourself!1. Telnet to your favorite Web server:!CS118!12!Opens TCP connection to port 80 (default HTTP server port) at cis.poly.edu. Anything typed in is sent to port 80 at cis.poly.edu telnet cis.poly.edu 80 2. Type in a GET HTTP request:!!GET /~ross/ HTTP/1.1 Host: cis.poly.edu By typing this in (hit carriage return twice), you send this minimal (but complete) GET request to HTTP server 3. Look at response message from the HTTP server!!lixia% telnet cis.poly.edu 80!Trying 128.238.32.126...!Connected to cis.poly.edu.!Escape character is '^]'.!GET /~ross/ HTTP/1.1!Host: cis.poly.edu!!HTTP/1.1 200 OK!Date: Sun, 03 Apr 2011 19:48:33 GMT!Server: Apache/1.2.5!Last-Modified: Tue, 22 Jun 2010 19:20:37 GMT!ETag: "2b3e-258f-4c210d05"!Content-Length: 9615!Accept-Ranges: bytes!Content-Type: text/html!!<html xmlns:m="http://schemas.microsoft.com/office/2004/12/omml">!CS118!13!CS118!14!<head><meta http-equiv=Content-Type content="text/html; charset=windows-1252"><link rel=Edit-Time-Data href="index_files/editdata.mso">!<title>Keith Ross's Homepage</title><link rel=themeData href="index_files/themedata.thmx"><link rel=colorSchemeMapping href="index_files/colorschememapping.xml”>!......!</head>!<body lang=EN-US link=blue vlink=purple>!<div class=Section1><p class=MsoNormal>!<img width=225 height=221 id="_x0000_i1025" src=color.jpg> <br>&nbsp; </p>!<h2>!<font face="Arial">Keith W. Ross</font></h2>!<h3><font face="Arial">Leonard J. Shustek Professor of Computer Science <br>&amp; Department Head !</font> </h3>! CS118!15!User-server state: cookies!Many Web sites use cookies!4 components:!1) cookie header line of HTTP response message!2) cookie header line in HTTP request message!3) cookie file kept on user’s host, managed by user’s browser!4) back-end database at Web site!Example:!# Susan access Internet always from same PC!# She visits a


View Full Document

UCLA COMSCI 118 - week2

Download week2
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view week2 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view week2 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?