Client/server

Ahhh, client/server.  One of the most widely used and yet misunderstood sayings in the industry.

Riddle me this Batman: a client can be a server and a server can act as a client. Clients can connect to servers, but servers do not connect to clients. So, which is which and what are you using?

The problem is thinking in terms of "email".  There is no "email" protocol.  There is no client or server software called "email" with proprietary file types, and no "email" port that all email is sent on.  "Email"  is just a string of bits that's stored on computers, and a set of protocols to transmit these bits from one computer to another.

What's confusing  people is that "email client" software simply acts as a client for all three main protocols, POP3, IMAP and SMTP.  An email server could very easily have email client software installed on it, and act both as the server that the locally installed "client" software connects to and as the client that's downloading the email or sending email "out" to the locally installed server.

To illustrate this further, in SMTP, RFC 2821 describes SMTP relaying like this:

"If (a SMTP server) accepts the task (of relaying a message), it then becomes an SMTP client, establishes a transmission channel to the next SMTP server specified in the DNS... and sends it the mail.  "

So, explicitly in the RFCs, it states that a SMTP server can act in a client "role".

Roles in POP3 and IMAP are the more commonly accepted tasks where the clients connect to the server to download the data into their local cache.


On to an object lesson.  Think about this:

You have a SMTP server that does not store any email.  It acts as a SMTP relay, and sends all the email to another server (the "Destination-MTA").  You could install client software on it to connect to the Destination-MTA via POP3 and download all the data that had already passed through it via SMTP.  Users then connect to it via IMAP to view their email.

This server then completes the following roles:

Server (when the sending server sent the email to it via SMTP to be relayed)
Client (when it transmitted the email via SMTP to the Destination-MTA)
Client (when it downloaded the data via POP3 from the Destination-MTA
Server (when users connected to it via IMAP)

Although confusing (and horribly inefficient), stop here and think about this scenario for a moment.  This would work and might even exist in some bizarro environment somewhere.

In summary,  clients and servers really are role based terms based on what part of the delivery process they play and in which protocol they are communicating.  In SMTP the client has the data, it connects to the server and then sends it to the server.  In POP3/IMAP, the server has the data, the client connects to it and then downloads the data.


-TEA