Domain
Name
System
• Mapping between IP address and name
server
• Initially mapping was done using the Host
file
– Two columns: Name and Address
25.1 Name Space
Flat Name Space
Hierarchical Name Space
Nature of Org
Name
Dept
25.2 Domain Name Space
Label
Domain Name
Figure 25.2 Domain names and labels
• Fully Qualified Domain Name
– Reaches till root node
– Ends with null (dot)
• Partially Qualified Domain Name
– Does not reach the root node
– Used when the name to be resolved belongs
to the same site of the client
– Resolver can provide the missing part/suffix
– [Link] wants the IP of challenger, partial
name can be defined “challenger”
– DNS client adds suffix [Link]
Figure 25.4 Domains : Subtree of DNS
25.3 Distribution of Name Spaces
Hierarchy of Name Servers
Zone
Root Server
Primary and Secondary Servers
Figure 25.5 Hierarchy of name servers
Figure 25.6 Zones and domains
Note:
A primary server loads all information
from the disk file; the secondary server
loads all information from the primary
server.
25.4 DNS In The Internet
Generic Domain
Country Domain
Inverse Domain
Figure 25.7 DNS in the Internet
Figure 25.8 Generic domains
Table 25.1 Generic domain labels
Label Description
com Commercial organizations
edu Educational institutions
gov Government institutions
int International organizations
mil Military groups
net Network support centers
org Nonprofit organizations
Table 25.2 New generic domain labels
Label Description
aero Airlines and aerospace companies
biz Businesses or firms (similar to com)
coop Cooperative business organizations
info Information service providers
museum Museums and other nonprofit organizations
name Personal names (individuals)
pro Professional individual organizations
Figure 25.9 Country domains
Figure 25.10 Inverse domain: Map an address to name
25.5 Resolution
Recursive Resolution
Iterative Resolution
Figure 25.11 Recursive resolution
Figure 25.12 Iterative resolution
Figure 25.13 Query and response messages
Note:
DNS can use the services of
UDP or TCP,
using the well-known port 53.
HTTP
and
WWW
27.1 HTTP
Transaction
Request Message
Response Message
Headers
Note:
HTTP uses the services of TCP on
well-known port 80.
Figure 27.1 HTTP transaction
Figure 27.2 Request message
Figure 27.3 Request line
Figure 27.4 URL
Figure 27.5 Response message
Figure 27.6 Status line
Figure 27.7 Header format
Figure 27.8 Headers
27.2 World Wide Web
Hypertext and Hypermedia
Browser Architecture
Static Document/HTML
Dynamic Document/CGI
Active Document/Java
Figure 27.11 Distributed services
Figure 27.12 Hypertext
Figure 27.13 Browser architecture
Figure 27.14 Categories of Web documents
Figure 27.15 Static document
Figure 27.16 Boldface tags
Figure 27.17 Effect of boldface tags
Figure 27.18 Beginning and ending tags
Table 27.1 Common tags
Beginning Ending
Meaning
Tag Tag
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> Defines the title of the document
Table 27.1 Common tags (continued)
Beginning Ending
Meaning
Tag Tag
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
Table 27.1 Common tags (continued)
Beginning Ending
Meaning
Tag Tag
List Tags
<OL> </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
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>
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/[Link]" ALIGN=MIDDLE>
</BODY>
</HTML>
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="[Link]
Producer </A>
</BODY>
</HTML>
Figure 27.19 Dynamic document
Example 6
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
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
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
Figure 27.20 Active document
Figure 27.21 Skeleton of an applet
Figure 27.22 Instantiation of the object defined by an applet
Figure 27.23 Creation and compilation
Figure 27.24 HTML document carrying an applet
Example 9
In this example, we first import two packages, [Link] and [Link]. They
contain the declarations and definitions of classes and methods that we need. Our
example uses only one publicly inherited class called First. We define only one
public method, paint. The browser can access the instance of First through the
public method paint. The paint method, however, calls another method called
drawString, which is defined in [Link].*.
import [Link].*;
import [Link].*;
public class First extends Applet
{
public void paint (Graphics g)
{
[Link] ("Hello World", 100, 100);
}
}
Example 10
In this example, we modify the program in Example 9 to draw
a line. Instead of method drawString, we use another method
called drawLine. This method needs four parameters: the x and
y coordinates at the beginning of the line and the x and y
coordinates at the end of the line. We use 0, 0 for the beginning
and 80, 90 for the end.
import [Link].*;
import [Link].*;
public class Second extends Applet
{
public void paint (Graphics g)
{
[Link] (0, 0, 80, 90);
}
}
END
(Effort Never
Dies)