0% found this document useful (0 votes)
44 views43 pages

Chapter 1-Introduction

The document discusses the basics of the internet including how it functions, the difference between the internet and the world wide web, common internet applications, and key concepts like IP addresses, domains, URLs, web servers, browsers, static vs dynamic content. It provides details on how requests and responses are made between clients and servers.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views43 pages

Chapter 1-Introduction

The document discusses the basics of the internet including how it functions, the difference between the internet and the world wide web, common internet applications, and key concepts like IP addresses, domains, URLs, web servers, browsers, static vs dynamic content. It provides details on how requests and responses are made between clients and servers.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 43

Introduction

Introduction
 The Internet – it is a huge network of computer networks
 An infrastructure (connectivity among a large number of
machines world wide)
 a connection of computer networks using the Internet Protocol
(IP)
Internetworking
 When two or more separate networks are connected for
exchanging data or resource, they become
Internetworking

2 Internet Programming
3 Internet Programming
 What's the difference between the Internet and the World
Wide Web (WWW)?
 the Web is the collection of web sites and pages around
the world; the Internet is larger and also includes other
services such as email, chat, online games, etc.

4 Internet Programming
 Several applications:
 E-mail
 www
 File transfer (FTP)
 Remote login
 E-commerce
 Instant messaging (chat)
 Mailing lists
 …

5 Internet Programming
Introduction (cont’d)
 www (world wide web)
 A collection of websites
 web server: software that listens for web page
requests
 Apache
 Microsoft Internet Information Server (IIS) (part of Windows)
 web browser: fetches/displays documents from web
servers
 Mozilla Firefox
 Microsoft Internet Explorer (IE)
 Apple Safari
 Google Chrome
 Opera

6 Internet Programming
 A website
 A collection of resources:
 Web pages (static / dynamic)
 Media files (images, animations, sound, …)
 Style files (CSS)
 Documents (pdf, doc, txt, rtf, …)
 …
 Has a globally unique name
 E.g. www.aau.edu.et
 Stored on machines called web servers

7 Internet Programming
 Web servers are computers which offer information to
the reader. They store web pages and transmit to the
client.
 Web server Software:
 responds to client request for information
 Accept data from the client.

8 Internet Programming
Introduction (cont’d)
 A web page
 A document with a mark-up language called HTML
 The basic unit of information storage on the www

Web document can be categorized into 3 types:


i) Static
ii) Dynamic
iii) Active
Static document
Fixed content document and stored on a server
The client can get only one copy of that document
The HTML is used to create static document

9 Internet Programming
Dynamic Documents
 Don’t exist in predefined format
 Created by a web server
 When a browser request arrives, the web server runs an application
that creates the dynamic content.
 The server software returns the output of the program as a response to
the browser
 A fresh document is created for each request
 The content of dynamic document can vary from one document to
another.
 Eg: CGI common gateway interface
 Is a technology that creates and handles dynamic documents

10 Internet Programming
 Php, asp, ISP, CSS
 Active Document
 For many applications, we need a program to be run at the
client side. These are called active documents.
 Eg. We want to create a program that creates animated graphics
on screen or interact with the user
 When a browser requests the document, the server sends a copy
of the document in the form of bytecode
 The document runs at the client side.
 An active doc is transported from server to client in the form of
binary. It means it can be compressed at the server side and
decompressed at the client side

11 Internet Programming
 How does the www work
 Websites (with unique names) are stored on web servers
 Users access these websites via the Internet using software
called a web browser.
 A user sends requests for resources from a server with the help
of the a user agent (browser)
 The server sends the requested resource to the user agent
 The user agent renders the resource for the user to view.

12 Internet Programming
WWeb browser Web sWeb server

Internet

 Eg; http://www.yahoo.com/index.html
 The browser requests the DNS for the IP address
corresponding to www.yahoo.com
 The DNS replies with the IP address
13 Internet Programming
 The browser makes TCP connection with the server
computer
 The client makes explicit request for the web page
(index.html at yahoo.com) at the server using http request
 The http request is series of lines , which among contents
two important statements are:
Get /index.html
Host: yahoo.com
 It indicates that index.html needs to be retrieved and for
the file index.html, the domain name is yahoo.com

14 Internet Programming
 The request is handed over the http software running on the
client machine transmitted to the server
 The http software on the client now hands over the http
request to TCP/IP software running on the client
 The TCP/IP software on the client breaks the http request
into packets and sends them to the TCP/IP of the web server
 The TCP/IP running on the web server reassembles the http
request using the packets and gives to the http software
running on the web server.
 The OS on the server locates the index.html and gives the
http software on the server.

15 Internet Programming
 The http software running on the web server adds some
headers to form an http response
 The http on the web server now hands over the http
response to the TCP/IP response to the web server
 The TCP/IP software running on the web server breaks
the http response into packets and sends it over the TCP
connection to the client
 The TCP/IP software on the client computer checks the
packet for correctness and reassembles them to for the
original message into html form

16 Internet Programming
Introduction (cont’d)
 Software involved:
 At the server:
 Web server software : listens for incoming requests for resources from
clients and serves the requests
 Apache - open source
 IIS (Internet Information Services) – Microsoft
 Squid
 …
 At the client:
 Web browser : sends/receives requests/responses to/from web servers on
behalf of the client and renders content as necessary
 Microsoft Internet Explorer
 Mozilla
 Firefox
 Googke Crome
 Opera
 Safari
 …

17 Internet Programming
Introduction (cont’d)
 Communication protocol
 HTTP (HyperText Transfer Protocol)
 Client (web browser) and Server (web server) communicate via the
HTTP to exchange request/response messages

 The web is governed by the w3c (world wide web


consortium) (www.w3.org)

18 Internet Programming
Introduction (cont’d)
 How are websites uniquely named?
 DNS (Domain Name System)
 set of servers that map written names to IP addresses
 Resolves a human friendly name (eg www.google.com) to a machine
friendly IP address (eg 64.233.187.99)
 “Phone book” of the Internet
 For this purpose, DNS servers store a table containing name-IP (among
other things) pairs and do a look-up when requested
 A DNS server may communicate with other server to resolve a given name
 many systems maintain a local cache called a hosts file
 Windows: C:\Windows\system32\drivers\etc\hosts
 Mac: /private/etc/hosts
 Linux: /etc/hosts
 There are about 12 root DNS servers (http://www.root-servers.org/)

19 Internet Programming
Introduction (cont’d)
 DNS name structure
 Hierarchical in nature (eg. cs.aau.edu.et)
 cs is under aau (a subdomain of aau), aau is under edu, edu is under et.
 The highest level is the last component of the DNS address
 Labels separated by . (dot)
 Labels can be up to 63 characters long and are case insensitive
 A maximum of 255 characters is allowed in total

 The last (highest) labels of a DNS name can be:


 Three letter code top level domains (TLDs): indicating the type of
organization
 com, edu, gov, net, org, biz, …
 Two letter country codes (CCTLDs): indicating the country
 et, us, za, uk, tv, …

20 Internet Programming
Introduction (cont’d)
 URL (Uniform Resource Locator)
 The exact address of a resource on the web
 an identifier for the location of a document on a web site
 Format:
 <protocol>://<host>[:<port>][<path>][?<query>]
 E.g. http://www.somedomain.com/search.php?q=dns&lang=en

 Protocol – identifies the type of protocol to be used for communication


 http, ftp, mailto, …
 Host – identifies the machine on which the requested resource is stored
 It the computer where info. Is located.
 It is registered with domain name and associted IP adress
 Domain names (eg. www.google.com)
 IP address
 Port – identifies the port number of the web server software on the web server machine
 Default port for http: 80
 Path – identifies the name and path of the resource on the server
 The path name of the file where info is located
 Query – specifies parameters, if any, that should be sent to the server along with the request
 has the form: ?var_name1=value1&var_name2=value2&…

21 Internet Programming
 Eg: http://www.aw-bc.com/info/regesstepp/index.html
upon entering this URL into the browser, it would:
 ask the DNS server for the IP address of www.aw-bc.com
 connect to that IP address at port 80
 ask the server to GET /info/regesstepp/index.html
 display the resulting page on the screen

22 Internet Programming
 More advanced URLs
 anchor: jumps to a given section of a web page
http://www.textpad.com/download/index.html#downloads
 fetches index.html then jumps down to part of the page labeled downloads

 port: for web servers on ports other than the default 80


 http://www.cs.washington.edu:8080/secret/money.txt
 query string: a set of parameters passed to a web program
 http://www.google.com/search?q=miserable+failure&start=10
 parameter q is set to "miserable+failure"
 parameter start is set to 10

23 Internet Programming
HTTP
HyperText Transfer Protocol (HTTP)

 A protocol that enables communication b/n browser and


web server
 the set of commands understood by a web server and sent
from a browser
 some HTTP commands (your browser sends these
internally):
 GET filename : download
 POST filename : send a web form response
 PUT filename : upload

25 Internet Programming
 simulating a browser with a terminal window:
$ telnet www.cs.washington.edu 80
Trying 128.208.3.88...
Connected to 128.208.3.88 (128.208.3.88).
Escape character is '^]'.

GET /index.html
 ...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 ...">
<html>

26 Internet Programming
 A stateless protocol
 http does not remember anything about the previous request.
 It does not maintain any information about the state.
 Each request a browser sends to a web server is independent of
any other request
 Stateless means there is no record of previous interactions
and each interaction request has to be handled based
entirely on information that comes with it
 HTTP conversation involves the exchange of HTTP
messages.

27 Internet Programming
HTTP Message
 Is either a request from client to server or
 A response from server to client

 Messages are composed of:


 A start line
 One or more header fields
 An empty line – indicating the end of the header fields
 A message body (optional)

28 Internet Programming
HTTP Message - Example
HTTP/1.1 200 ok
Server: Microsoft-IIS/5.0
Date: Mon, 12 Aug 2014 08:05:30 GMT
Content-Type: text/html
Accept-Ranges: bytes
Last-Modified: Tue, 13 Aug 2007 09:34:22 GMT
Content-Length: 240

<html><head><title>page titiel</title></head>
<body>some content</body></html>

29 Internet Programming
Message Body
 Used to carry an entity body
 May be divided into chunks and sent
 Optional, i.e. messages are not required to have a message
body
 Some messages cannot even have a message body

 Example of message body:


 A web page

30 Internet Programming
HTTP Header
 Contains header fields
 The header fields can be:
 General headers
 Request headers
 Response headers
 Entity headers
 All header fields follow the same generic format
 Each header field consists of a name followed by and
colon (:) and a value:
 Header-name:value
 The order of the header field is insignificant
31 Internet Programming
General HTTP Header
 Used to specify properties of the transfer process

 Examples:
 Connection:close – client wants to close the connection when
the first response is complete
 Cache-control – client can specify additional properties if the
requested resource is cached (e.x. age)
 Date
 Transfer-Encoding
 …

32 Internet Programming
Entity Headers
 Give meta-information about the entity body (message body)
being transferred
 Apply only if a message body exists

 Examples:
 Content-Encoding – indicates type of content encodings applied (e.x.
zipped)
 Content-Language – language of the intended audience
 Content-Length – size of the entity body (message body)
 Expires
 …

33 Internet Programming
Request Headers
 Add additional information about the request
 May include information about the client/sender,
including client capability

 Examples:
 Accept - acceptable media types for response
 Accept-Charset – acceptable character set
 User-Agent – client browser
 …

34 Internet Programming
Response Headers
 More information, in addition to the status line
 May contain information about the server or resource

 Examples:
 Age – estimate of time since response was generated
 Location – used to redirect to a different location (URI)
 Proxy-Authenticate – proxy authentication challenge
 Server – information about the web server software
 …

35 Internet Programming
HTTP Request
 The request line contains three parts:
 Request method
 Request URI
 HTTP Version

 Request method
 GET: for requesting a web server sending a particular page
 POST (information) back to the server
 It is used to update an existing file with additional data
 It is used to send other data to the web server
 HEAD – like GET but only returns meta-information
 eg: if the browser wants to know the last modified data of a web page
it would use the head command.

36 Internet Programming
 PUT: it is the opposite of get command. It sends a file to the
server for storing it there.
 DELETE (information) from the server
 This command allows a browser to send an http request for
deleting a particular web page

37 Internet Programming
HTTP Request (cont’d)

 HTTP Version
 Used by the sender to notify the receiver of its abilities
 Included in the first line of the message
 Format: HTTP/<major>.<minor>
 E.x. HTTP/1.1

 Request URI
 The URI of the resource requested

38 Internet Programming
HTTP Response
 The response line contains:
 HTTP version
 Status code
 Status code description

E.x. HTTP/1.1 200 ok

 Status code
 Has 5 categories

39 Internet Programming
HTTP Response (cont’d)

 1xx – request received, processing continues


 E.x.
 100 Continue – tells client to continue with a request
 2xx – success, action was successfully received, understood
and accepted
 E.x.
 200 Ok – request has succeeded
 202 Accepted – request accepted but not processed
 3xx – further action must be taken to complete the request
 E.x.
 302 Found – resource found but temporarily moved

40 Internet Programming
HTTP Response (cont’d)
 4xx – client error or invalid request
 E.x.
 400 Bad Request – couldn’t understand request
 401 Unauthorized – request requires authorization
 403 Forbidden – client may not have access to the resource

 5xx – server error occurred


 E.x.
 500 Internal Server Error – server encountered an unexpected error
(error/bug with a server side script)
 505 HTTP Version Not Supported – server doesn’t support the HTTP
version

41 Internet Programming
 Internet media ("MIME") types
 sometimes when including resources in a page (style sheet,
icon, multimedia object), we specify their type of data
MIME Type File Extension
text/html .html
text/plain .txt

image/gif .gif

image/jpeg .jpg

video/quicktime .mov

application/octet- .exe
stream
42 Internet Programming
Web languages / technologies
 Hypertext Markup Language (HTML): used for writing web
pages
 Cascading Style Sheets (CSS): stylistic info for web pages
 PHP Hypertext Processor (PHP): dynamically create pages on
a web server
 JavaScript: interactive and programmable web pages
 Asynchronous JavaScript and XML (Ajax): accessing data for
web applications
 eXtensible Markup Language (XML): metalanguage for
organizing data
 Structured Query Language (SQL): interaction with databases

43 Internet Programming

You might also like