Client-server, NAT, and Email
Download
Report
Transcript Client-server, NAT, and Email
Client-Server Interaction
Based on Chapter 28 in
Computer Networks and
Internets, Comer
CSIT 220 (Blum)
1
Network Applications
All of the lower layers of the network communication
protocol stack exist so that applications on different
computers can interact.
Applications are high-level software used directly by
users.
The applications (e.g. Excel) sit on top of the
application layer which provides various networkrelated services (e.g. FTP) to the applications.
The basic paradigm for this application-to-application
interaction on an internet is the client-server model.
CSIT 220 (Blum)
2
Application Software
Applications and the application layer hide all of the
details of the network from the user.
•
Information hiding
In most cases the user does not have to know the IP
address (let alone the MAC address) of the computer
he or she is communicating with.
The application provides a user-friendly symbolic
name, which is then translated into the
corresponding number.
•
E.g. a domain name service
CSIT 220 (Blum)
3
Connection-Oriented
While TCP is in part responsible for establishing a
session between two computers (the three-way
handshake), the TCP does not establish a connection on
its own volition.
The source application layer must direct its transport
layer to do so.
The destination application layer must direct its transport
layer to “listen for” others trying to connect to it.
In the phone analogy, the source must dial the number,
the destination must hear the phone ring and answer it.
CSIT 220 (Blum)
4
The client-server paradigm
The approach in which the source initiates
contact with a listening destination is said to
adhere to the client-server paradigm.
The initiating source is called the client.
• Clients are “active.”
The listening destination is called the server.
• Servers are “passive.”
CSIT 220 (Blum)
5
Two meanings
In one sense, client-server is used to refer to
the communication model
•
•
Client: Active requester
Server: Passive listener/responder
In another sense, client-server is used to refer
to machines which are designed to act as
clients or as (dedicated) servers
•
In this sense, a server is a machine capable of offering
a such service to a number of clients.
CSIT 220 (Blum)
6
What is a Server?
A server can refer to a program that passively
waits for communication.
A server can refer to a computer dedicated to
running server programs.
Your book uses the terminology “server class
computer” for the latter case.
•
•
But most of the world uses the term “server” in both
cases.
Servers or server-class computers are typically
powerful machines which run server software.
CSIT 220 (Blum)
7
Not the only paradigm in town
Client-server is not the only model for
computer-to-computer communication.
• Peer-to-peer: A type of network in which each
workstation has equivalent capabilities and
responsibilities. Peer-to-peer networks are generally
simpler, but they usually do not offer the same
performance under heavy loads.
• Master/slave: master polls the slaves to see if they
have anything to transmit.
CSIT 220 (Blum)
8
Mainframe architecture
Mainframes are an example of the masterslave model.
Most of the data storage and computing power
lies in the mainframe (a central computer).
Users interact with the mainframe via terminals
(“dumb terminals”) which is little more than a
monitor and keyboard.
In the early days of PCs, they were often
disabled to work as dumb terminals in a
mainframe.
CSIT 220 (Blum)
9
Thin and fat clients
There was an idea of returning to some extent to the
notion of a dumb terminal.
In client/server applications, a client designed to be
especially small so that the bulk of the data processing
occurs on the server is called a thin client.
A client that performs the bulk of the data processing
operations is called a fat client.
Although the term usually refers to software, it can also
apply to a relative abilities of a network computer.
CSIT 220 (Blum)
10
Client/Server Operating Systems
Often the version of the operating
system one loads on a computer that
mainly plays the client role will be
different from the version of the
operating system loaded on the server
• E.g. Windows 2000 is different from Windows
2000 Server
CSIT 220 (Blum)
11
The client
Client software
•
•
•
•
•
•
Requests service but also performs its own computations.
Is invoked directly by a user and executes only for one
session
• as opposed to starting automatically and running continuously
Usually runs locally on a user’s PC
Initiates contact with a server.
May access multiple services, but only communicates with
one server at a time.
Does not require special hardware (beyond standard
communications hardware) or Operating System.
CSIT 220 (Blum)
12
The Server
Server software
•
•
•
•
•
•
Is a special-purpose, privileged program dedicated to
providing one service.
Can handle multiple remote clients at the same time.
Is invoked automatically (typically when a system boots)
and continues to execute through many sessions.
Waits passively for contact from arbitrary remote clients.
Accepts contact from arbitrary clients, but offers a single
service.
Requires powerful hardware and a sophisticated operating
systems.
CSIT 220 (Blum)
13
Application Software
Applications (as opposed to services
provided by the application layer) that
communicate with other applications are
often written with either the client role or
server role specifically in mind.
Thus one talks about “client-side
scripting” and “server-side scripting.”
CSIT 220 (Blum)
14
Scripting
Client-side scripting is code written for the client
end of a client-server system.
•
Server-side scripting is code written for the
server end of a client-server system.
•
For example, JavaScript scripts are client-side
because they are executed by your browser (the
client).
For example, CGI scripts are server-side because they
run on the Web server.
Java applets can be either server-side or clientside depending on which computer (the server
or the client) executes them.
CSIT 220 (Blum)
15
Client-Server Interaction
Information between client-server passes in both
directions.
Clients request, servers respond.
Sometimes the server’s response is an ongoing
communication based on one initial request.
Client-server applications lead the protocol suite
to establish the session and send/receive
information.
A computer needs all stacks of the software
protocol suite to run as a client or server.
CSIT 220 (Blum)
16
Client-Server
CSIT 220 (Blum)
17
Multiple Services
A powerful computer can run multiple
clients and servers at the same time.
You need sufficient hardware resources
and an operating system which allows
multiple application programs to execute
concurrently (such as UNIX or WIN9x)
CSIT 220 (Blum)
18
One connection/Many services
A computer with multiple servers still requires only a
single physical connection for communication.
•
Different services will be associated with different ports.
Since servers are often in passive modes, having one
computer offer many services can help reduce
administrative overhead and cost without a significant
reduction in performance.
However, if many clients are expected for a particular
service it may be worthwhile having a machine
dedicated to it.
CSIT 220 (Blum)
19
Some Server Types
A file server is a computer and storage device
dedicated to storing files. Any user on the network
can store files on the server.
A print server is a computer that manages one or
more printers.
A network server is a computer that manages
network traffic.
A database server is a computer system that
processes database queries.
CSIT 220 (Blum)
20
Multiple services
CSIT 220 (Blum)
21
A thread for each request
In order to handle concurrency, that is, dealing with
many clients at once, the server-class computer uses
“threads.”
We mentioned certain services being associated with
well-known ports.
Actually the main thread or listener (usually a daemon)
is located at this port, but as soon as a request is made,
a new thread is spun off (forked) for it.
This allows the main listening thread to await the next
client.
CSIT 220 (Blum)
22
Thread
A thread is the information needed to serve
one individual user or a particular service
request.
If multiple users are using the program or
concurrent requests from other programs
occur, a thread is created and maintained for
each of them.
CSIT 220 (Blum)
23
Thread
The thread allows a program to know which client is
being served as the program alternately gets re-entered
on behalf of different users.
One way thread information is kept is by storing it in a
special data area and putting the address of that data
area in a register.
The operating system always saves the contents of the
register when the program is interrupted and restores it
when it gives the program control again.
CSIT 220 (Blum)
24
Types of Transport Protocols
The application services may be
connection-oriented or connectionless.
Connection-Oriented
• The applications must first establish the
connection and then send the data across the
connection. TCP requests the connection
and once established the communication
begins. Session must be terminated.
CSIT 220 (Blum)
25
Types of Transport Protocols
Connectionless Interface
• The application sends a message to the destination
at any time. The sending application needs to
specify the destination with each message sends.
The UDP is the connectionless support mechanism
in the TCP/IP protocol.
• For a client request using the connectionless
interface, servers often require the request to be sent
in a single message. The server responds in a single
message.
CSIT 220 (Blum)
26
Service Connections Choice
Servers may provide a service through both connection
methods.
The choice of transport is dependent on the client.
This choice requires the server to provide both transport
implementations. This may be implemented by
•
•
Setting up 2 servers for the same service, one for
connectionless transport and one for connection-oriented
transport.
Setting up a single server that is able to interact with
either type of transport protocol simultaneously.
CSIT 220 (Blum)
27
Client-Server Interactions
A client application is not restricted to accessing a
single service. A single application can become
the client of several servers over time.
A client application is not restricted to accessing a
single server for a given service. A client might
send a request to multiple servers to improve
performance.
A server is not restricted from performing further
client-server interactions . A server for one
service can become a client of another.
CSIT 220 (Blum)
28
Two-tier
The term two-tier refers to client/server
architectures in which the user interface
runs on the client and the database is
stored on the server.
The actual application logic can run on
either the client or the server.
CSIT 220 (Blum)
29
Three tier
A special type of client/server architecture consisting
of three well-defined and separate processes, each
running on a different platform:
1.
The user interface, which runs on the user's computer (the
client).
2.
The functional modules (business rules) that actually
process data. This middle tier runs on a server and is often
called the application server.
3.
A database management system (DBMS) that stores the
data required by the middle tier. This tier runs on a second
server called the database server.
CSIT 220 (Blum)
30
Three tier (Cont.)
The three-tier design has many advantages
over traditional two-tier or single-tier designs,
mainly:
•
•
The added modularity makes it easier to modify or
replace one tier without affecting the other tiers.
(Remember Layering and information hiding.)
Separating the application functions from the database
functions makes it easier to implement load balancing,
i.e. spreading the processing out
CSIT 220 (Blum)
31
Network Address Translation
and Electronic Mail
Based on Chapters 26 and
32 in Computer Networks
and Internets, Comer
CSIT 220 (Blum)
32
Network Address Translation
NAT (Network Address Translation) is a scheme
for a network to use one set of addresses internally
but to have the outside world see a different set of
addresses, possibly only one address.
•
•
It can be used as a security measure since it hides internal
addresses from the outside world.
It can be used to expand one’s address space. One can
use non-routable addresses, and different networks can use
the same internal addresses provided their external address
is unique.
CSIT 220 (Blum)
33
NAT: Figure 26.4
CSIT 220 (Blum)
34
NAT Tables
The translator understands the local
addresses and the external address. It
maintains a table of what internal
addresses (computers) are
communicating with which external
addresses.
CSIT 220 (Blum)
35
CSIT 220 (Blum)
36
Dilemma
But what if two internal addresses are
communicating with the same external
address?
How would the translator know which
internal address to deliver a message
to?
CSIT 220 (Blum)
37
Solution (NAPT)
Recall that beyond IP addresses there is an
additional part of the addressing scheme – the
ports. The translator can associate different
internal addresses with its different ports.
Then it can distinguish differ incoming
messages by which port they come in on.
This is known as Network Address and Port
Translation (NAPT).
CSIT 220 (Blum)
38
NAPT Table (Figure 26.4)
CSIT 220 (Blum)
39
Another Dilemma
Associating internal addresses with ports is
fine for sessions initiated by the internal
machines, but what if the the outside wants to
initiate?
The outside world will know the internal
computers not by IP addresses but by domain
names. Therefore this can be resolved by
having the local DNS and NAT servers
coordinate.
CSIT 220 (Blum)
40
E-Mail
E-mail was designed to serve as an
electronic version of the traditional office
memo.
E-mail can be used to be used for oneto-one or one-to-many communication.
It can also handle automatic response to
information requests.
CSIT 220 (Blum)
41
Mail box
In order for a person to receive mail, they are
assigned a “mail box” which is a location
(typically a directory in storage) designated to
hold incoming messages addressed to a
particular user.
•
•
The email server is given permission to write files in
this directory.
The user to whom the mail box is assigned is given
permission to access these files.
CSIT 220 (Blum)
42
Mail box
A mailbox is often associated with an account,
thus someone with multiple accounts may have
multiple boxes.
The mailbox is typically on the mail server and
not on the user’s computer.
While the user may have most of the
permissions in regard to his or her mail box, the
amount that can be stored there and so on is
controlled by the administrator of the mail server.
CSIT 220 (Blum)
43
Email Addresses
Addresses have 2 parts, e.g. [email protected]
The first part [email protected] denotes the mail box
(and in turn the person to whom it is assigned)
•
It allows the local administrators to assign mailbox
identifiers independently (no central authority).
The second part [email protected] denotes the mail
server at the domain, i.e. the computer to which the
message should be sent.
•
It allows users on arbitrary computer systems to
exchange email messages (is assigned by central
authority).
CSIT 220 (Blum)
44
E-Mail Message Formats
An email message consists of ASCII code.
As with most information protocols we have
studied, it has two parts
•
•
A header containing information about delivery — the
sender’s and recipient’s address along with various
other information.
A body containing the actual message to be delivered.
The two parts are separated by a blank line
(carriage return character).
CSIT 220 (Blum)
45
Header and body
header
body
CSIT 220 (Blum)
46
Some header fields
CSIT 220 (Blum)
47
SUBJECT, CC and BCC
Most headers include a SUBJECT field
•
•
Typically it conveys information about the body to the recipient.
It can be used to send commands to certain automated processes,
e.g. SUBJECT: subscribe.
The CC (carbon copy) field allows the message to be sent
to users other than the primary recipients.
BCC (Blind carbon copy) has a similar effect as CC except
that a BCC recipient’s address does not appear in the
message.
•
The primary recipient does not know that a blind carbon copy was
sent
CSIT 220 (Blum)
48
User and Transfer Agents
The Email system can be broken down into two
parts:
• One part is a user interface for composing and
reading messages. It is then placed in a queue
• (Sometimes called mail user agent)
• Another part for delivering messages to the intended
recipient on another computer (or indicating if delivery
was unsuccessful). It takes messages from the
queue and delivers them to the recipient’s mail box.
• (Sometimes called mail transfer agent)
CSIT 220 (Blum)
49
Mail Transfer
Delivery may be
• Local: Sending a message to a user on the same
•
computer simply requires that a copy of the
message be placed in the recipient’s mailbox.
Remote: Sending the message to a user on a
remote computer requires that sender’s transfer
software become a client of the recipient’s
transfer program. The remote computer must
append the message to the recipient’s mailbox.
CSIT 220 (Blum)
50
SMTP
Simple Mail Transfer Protocol is a set of rules
for transferring email messages using a TCP
connection.
SMTP allows the sender to identify itself, specify
a recipient and send an e-mail message, once
the connection has been established.
SMTP requires reliable delivery of a message
which means the sender keeps a copy of the
message in storage (nonvolatile) until the receiver
has stored the message.
CSIT 220 (Blum)
51
CSIT 220 (Blum)
52
Two Stage Delivery
Mail is not delivered directly to the typical end user’s
computer
•
•
Mail might arrive at any time and the mail server must be
ready to receive it at that time (it’s a TCP session), many
users’ computers are turned off when not in use.
Plus, each computer would have to operate the mail server
software.
The e-mail is delivered to a mail server and then the
user must retrieve it, so there is a second stage in
the delivery process.
CSIT 220 (Blum)
53
POP
One choice for this second stage of delivery is POP
(Post Office Protocol).
The mail server (the computer with the mailboxes)
also runs a POP server.
The POP server allows a user to run e-mail software
from his PC to access the mailbox remotely.
The POP server can be accessed via a dial-up
connection with the mailbox computer or via the
internet.
The POP server requires the client to authenticate
itself (username and password).
CSIT 220 (Blum)
54
POP
CSIT 220 (Blum)
55
IMAP
Internet Message Access Protocol is another
protocol for accessing e-mail from the mail server.
The e-mail client views just the message’s header
and then decide whether or not to download it.
IMAP also allows the client to create and
manipulate folders or mailboxes on the server,
delete messages, or search for certain parts or an
entire note.
CSIT 220 (Blum)
56
IMAP (Cont.)
IMAP is more sophisticated than POP.
IMAP requires continual access to the mail server
while one is working with one’s mail.
With POP3, when one reads mail, it is
immediately downloaded to the user’s computer
and is no longer maintained on the server.
IMAP can be thought of as a remote file server,
whereas POP can be thought of as a "store-andforward" service.
CSIT 220 (Blum)
57
Multiple Recipients
E-mail message can be effectively
multicast, that is, there may be more
than one recipient of the same message.
The transfer programs do not send
separate copies if more than one
recipient’s mail box is on the same mail
server.
CSIT 220 (Blum)
58
Multiple Recipients
One message is sent, then copies are
made by the end mail server. This saves
internet bandwidth and is more
egalitarian.
• Recipients with mailboxes on the same mail
•
server will all receive the message about the
same time.
If the internet fails, either all recipients or none
will receive a copy.
CSIT 220 (Blum)
59
Exploders, Lists and Forwarders
A mail exploder, or forwarder, is a program that
can forward copies of a message.
A mailing list is a database entry which is a list
of email addresses.
If a message is sent to a list, the exploder
forwards the message to each entry in the list.
If an individual wishes to receive mail for a
group, the individual’s email address must be
on the list.
CSIT 220 (Blum)
60
List server
A list server (mailing list server) is a
program that handles subscription
requests for a mailing list and
distributes new messages, newsletters
or other postings from the list's
members to the entire list of
subscribers as they occur or are
scheduled.
CSIT 220 (Blum)
61
E-Mail Application Programs
When an email message arrives at a computer, the
email software sends a copy of the message to the
specified user. If the “user” is an application program,
the email package sends the message to the
application instead of the mailbox.
This allows the user to make a request in an e-mail
message and the message to be sent directly to the
query system (application).
The application will extract the request, look-up the
answer and send an e-mail reply to the user.
CSIT 220 (Blum)
62
Extending email
Originally email was for sending messages,
so it used a simple ASCII (text) format, and to
exchange files, one used FTP. But
• Users were much more familiar with email and
wanted to extend its capabilities rather than use
an unfamiliar service.
• FTP (file transfer protocol) is essentially a pull
technology while email is a push technology.
CSIT 220 (Blum)
63
BinHex
E-mail attachments are the way in which one uses
the e-mail system meant to handle ACSII to deliver
non-ASCII files.
BinHex is one approach:
•
•
All files are in binary; a group of four binary numbers can be
though of as a number between 0 and 15 or in hexadecimal
notation a number between 0 and F; the hexadecimal
numbers can be replaced by the corresponding ASCII code
for the digit.
This replaces 4 bits with 7 or 8 (for ASCII) and while simple
is inefficient.
CSIT 220 (Blum)
64
uuencode
A more efficient binary-to-ASCII algorithm is
called uuencode.
Originally, this was done as a separate step
by the user before sending the file as an email message. And the receiver had to
uudecode the file.
But now with MIME, many of these steps are
done automatically and hidden from the user.
CSIT 220 (Blum)
65
MIME
Multipurpose Internet Mail Extension was invented
to coordinate and unify the encoding schemes used
for transfer. MIME does not dictate a single standard.
The sender and receiver exchange a convenient
encoding sequence. If a message has several parts,
the encoding sequence for each part may be
different.
This allows transmission of graphics and plain text
messages.
MIME is flexible. MIME is compatible with older email systems.
CSIT 220 (Blum)
66
MIME (Cont.)
In 1991, Nathan Borenstein of Bellcore
proposed to the IETF that SMTP be
extended so that Internet client and
server could recognize and handle other
kinds of data than ASCII text.
As a result, new file types were added to
"mail" as a supported Internet Protocol
file type.
CSIT 220 (Blum)
67
MIME (Cont.)
Clients use a header to select an appropriate
"player" application for the type of data the header
indicates.
Some of these players are built into the Web client or
browser (for example, all browser come with GIF and
JPEG image players as well as the ability to handle
HTML files); other players may need to be
downloaded.
New MIME data types are registered with the
Internet Assigned Numbers Authority (IANA).
CSIT 220 (Blum)
68
S/MIME
Secure Multi-Purpose Internet Mail Extensions is a
secure method of sending e-mail attachments that
uses the Rivest-Shamir-Adleman (RSA) encryption
system.
S/MIME is included in the latest versions of the Web
browsers from Microsoft and Netscape and has also
been endorsed by other vendors that make
messaging products.
An alternative to S/MIME is PGP/MIME.
CSIT 220 (Blum)
69
finger
A UNIX program that takes an e-mail address as input
and returns information about the user who owns that
e-mail address.
On some systems, finger only reports whether the user
is currently logged on. Other systems return additional
information, such as the user's full name, address, and
telephone number.
Of course, the user (or system administrator) must first
enter this information into the system. Many e-mail
programs now have a finger utility built into them.
CSIT 220 (Blum)
70
finger
CSIT 220 (Blum)
71
Finger blocked
CSIT 220 (Blum)
72
Other References
http://www.whatis.com
http://www.webopedia.com
CSIT 220 (Blum)
73