Title: Hooman nili
1The WWW Part 2 an introduction to
clientserver-sidetechnologies
Hooman nili
2The WWW Part 2 an introduction to
clientserver-sidetechnologies
Hooman nili
3Background
- What is a Web server? A web server is a software
that uses the client/server model to server web
pages.
4Background
What is a Web server? Essentially, a web
server, as a piece of software, needs to be
installed and configured on a machine (server
hardware) before it can do anything. Once
installed and configured, the operating system
can then open a specific network port for the web
server before it can respond to any HTTP
requests. (This is the most common practical
approach)
5Background
What is a Web server? The default port number
for web servers is 80. A web server thats ready
to respond to HTTP requests is said to be
listening on port 80 (if thats the port number
its been allocated to) It is possible to
allocate a port number other than 80 to a web
server. It is also possible to run more than
one web server on a the same machine (aka
host/node)
6Background
What is a Web server? Most web servers can
respond to many simultaneous client requests.
The client is usually a web browser, but it
could be any HTTP client application e.g. web
crawlers, or even an interactive Telnet session.
The resource request is always made using some
version of the HTTP typically to send the
contents of file stored (hosted) on the server.
7Background
- The architecture of web service
- (In this case Apache)
8Background
What is a Web server? Although the web servers
main purpose is to retrieve information from a
central storage, todays web servers are capable
of performing other tasks as well. Before
transferring a file (resource), most web servers
can instruct the client how to interpret or
format the resource. Web servers can perform user
authentication, data encryption as well as
facilitating database access on clients behalf.
9How?
- The Web browser sends a request for a web
page. - The Web server receives (if) a request for a
web page. e.g www.pdldold.com - The Web server then maps the URL to a
local file on the host server. - The server then loads this file from disk
and serves it out across the network to the
Web browser. - The browser and the server talk thro. HTTP.
10Name-based Web serving (In this case
Apache-again!)
11How ?
- When a web server like Apache (HTTP 1.1)
receives a request from a client (browser) it
will generally perform one of the following
actions - It will either respond to the request by serving
a document (resource) or - refuse to respond to the request followed by a
numeric status code indicating why the particular
resource could not be served. In this case, a
numeric status code between 300-399, means the
server is redirecting the request to an
alternative location
12HTTP Com. TCP/IP layers (DoD)
TCP
TCP
IP
IP
13Some popular Web servers
14How popular?
March 2004 Web Server Survey www.netcraft.co.uk
(also www.securityspace.com )
15How popular?
March 2003 Web Server Survey
Top Developers - Recent
16How popular?
March 2007 Web Server Survey www.netcraft.co.uk
(also www.securityspace.com )
17How popular?
2003 vs 2007
18How popular?
Market Share for Top Servers Across All Domains
August 1995 - July 2009
19What is a Web scripting Language?
- Web scripting languages enable Web developersto
create dynamic Web pages which can respond to
viewers behaviours. - Examples
- Checking browsers settings (e.g. cookies)
- Authentication /Access restriction
- Shopping carts
- Sending emails thro. Web sites.
-
20Client-side scripting
- In client-side scripting, we totally rely on the
users browser to interpret and execute the
code. - JavaScript is the de facto for client-side
scripting. - In client-side scripting the requested file (web
page) is saved to the browsers cache and is
executed from the local hard disk.
21Sever-side scripting
- In server-side scripting, we mainly (90 ) rely
on the Web server to execute the code. - Sever-side scripting provides the means for
database access. - Its usually more flexible, especially with
respect to databases. We can generate
customised replies, and interfaces for viewers.
22How server-side works
Server
Response
parser or script engine
HTML
HTML with server-side scripts
Client
Request
23Popular server-side tools
- ASP Active Sever PagesFile extension .asp
- Developed by Microsoft, can be programmed in a
variety of scripting languages such as VBScript,
JavaScript, JScript, etc. - Runs mainly on IIS (Internet Information
Services) - Talks to databases like Access, MS SQL.
24Popular server-side tools ...
- Perl Practical Extraction and Report
LanguageFile extension .pl - Written by Larry Wall in 1987, its a high-level
scripting (some say programming) language. - Widely used on the Web and runs on many
operating systems. - On the Web, its usually incorporated in the
Common Gateway Interface (CGI). - Its free
25Popular server-side tools
- PHP PHP Hypertext PreprocessorFile extensions
.php, .php3, .php4, .phtml - Originally stood for Personal Home Page, and
developed by Rasmus Lerdorf in 1994 - Its considered as ASPs counterpart by many
developers. - Talks to virtually all databases, but most
often is used with MySQL (Free). - Works with virtually all Web servers.
- Its free and open.
26Popular server-side tools
- CGI Common Gateway InterfaceFile extensions ?
- Its a method for connecting web pages to the
programs or scripts running on the server to
which visitors would have limited access. - CGI applications can be written in a variety of
languages including Perl, C, Java, and VB. - Its supported on virtually all web servers.
- CGI is NOT a programming language itself.
27Examples
Say Hello in ASP lt_at_ languageVBScript
gt lthtmlgt ltheadgtlttitlegtHello ASPlt/titlegt lt/headgt lt
bodygt lt Response.Write(Hello ASP) gt lt date
gt ltbrgt lt time gt lt/bodygt lt/htmlgt
28Examples
Say Hello in PHP lthtmlgt ltheadgt lttitlegtHello
PHPlt/titlegt lt/headgt ltbodygt lt? echo "lth2gtHello
PHPlt/h2gt" ?gt lt/bodygt lt/htmlgt
29Examples
Say Hello in Perl !/usr/bin/perl Print HTTP
header (\n is newline character) print
"Content-type text/html\n\n" Print start of
HTML page. print "lthtmlgt\nltbodygt\n" Store
Hello World in a the string message (\n denotes a
new line). my message "Hello World" Print
hello world ten times. for (1..10) print
message Print end of HTML page. print
"lt/bodygt\nlt/htmlgt\n"
30Examples
- Say Hello and show date using CGI
- First a link in a web page
- lta href../cgi-bin/hellogtHello CGIlt/agt
- Now a shell script running on the server
- !/bin/sh
- echo Content-type text/plain
- echo
- echo Hello CGI
- echo
- /bin/date
31Resources
- ASP/IIS http//www.microsoft.com
- PHP http//www.php.net
- Apache http//www.apache.org
- MySQL http//www.mysql.com
- Perl http//www.perl.com
32Discussion Time
- Server-side or client-side?
- To Microsoft or Not Microsoft? thats the
question! - Apache or IIS? (Windows or Unix?)
-
- ASP or PHP?
- What is ASP.NET?
- Difference between ASP.NET and ASP
- Open Source
33Discussion Time.
- PHP vs ASP.NET
- Will .NET dictate the future of web
applications? -
- PHP is interpreted, but .NET is complied.
Correct? Which is faster? - Object Orientated Programming. PHP and ASP.NET
- Difference between ASP.NET and ASP
- IS ASP.NET better than PHP for business web
appz? (corporate support, etc)