The services layer

See more about:

Where are we?

We talked about the bucket o’ numbers layer. Now let’s move on the services layer.

This lesson's topic

Figure 1. This lesson’s topic

This lesson’s goals

By the end of this lesson, you should:

  • Know that a service is something one computer does for another.
  • Know how the email protocol SMTP works.
  • Know how the Web protocol HTTP works.

A “service” is something that one computer does for another. Like send email, send Web pages, save data to a database, whatever. Email is one of the easiest services to understand, so let’s start with that.

Sending email

Jake wants to send an email to Jules. He starts up his email client (Jake uses Windows Mail). That’s software running on his computer that lets him type in an email. When he’s ready to send the email, he clicks the Send button.

Email client

Figure 2. An email client

The term “client” has more than one meaning. Sometimes, “client” means the physical computer Jake is using. Sometimes, “client” means the email software running on the computer (Windows Mail). You have to figure out from the context what is meant.

Jake’s email client can’t send email by itself. It doesn’t have a domain name (the “evildoom.com” part of “jake@evildoom.com”). Instead, Jake’s email client asks another computer to send the email, a computer that does run the email part of evildoom.com. This email server offers email service to everyone with an EvilDoom account.

Client and server

Figure 3. Client and server

Just like the word “client,” the word “server” is overloaded. Sometimes, it means a physical computer. Sometimes, it means some software running on that computer, that offers services.

There’s lots of different email server software. qmail, Microsoft Exchange, and others.

When Jake sets up his email software, he has to tell it which server to talk to:

Identifying a server

Figure 4. Identifying a server

Jake’s email client starts a conversation with the email server. It goes something like this:

Client: HELO mail.evildoom.com
Server: 250 Hello evildoom.com
Client: rcpt to: jules (at) dogbowl.com
Server: 250 Ok
Client: DATA
Server: 354 End data with .
Client: Subject: Study group meeting
Client: D00d,
Client:
Client: I'm buying the coffee tonight.
Client:
Client: Jake
Client: .
Server: 250 Ok Mail queued for delivery
Client: QUIT
Server: 221 Bye

The conversation follows some rules, such as using HELO to start, and ending the message with a period (.) on a line by itself. The set of rules are called the simple mail transfer protocol (SMTP).

Jonathan Postel created the SMTP protocol. He wrote down the rules in a document called RFC 821. It’s great reading if you have trouble sleeping. You can see it at http://www.freesoft.org/CIE/RFC/821/index.htm.

When Microsoft’s programmers created Microsoft Mail, they read RFC 821, so they’d know how their program (a client) should talk to servers. They put in an instruction something like this:

print "HELO " & computer_name;

Now suppose that EvilDoom is running the qmail server. The dude who wrote it, Dan Bernstein, read RFC 821, so he knew what clients would send and what responses they would expect. He added code something like this:

get Command;
if ( Command == 'HELO' ) call StartMessage;

The two functions of a client

You can see that the client software has two main functions.

Client functions

Figure 5. Client functions

First, it has to support the user’s tasks. For email, that means (1) letting the user create messages, and (2) showing messages from other people.

Second, the client has to be able to talk to a server. They have to share the same protocol (set of communication rules), otherwise they won’t be able to interact.

The importance of standards

Note how important standards are. The only reason that the Microsoft Mail client can talk to the qmail server is that they both support SMTP. “Standards compliance” means that software uses standards.

Who creates standards? All sorts of people, but some groups are more important than others. SMTP is supported by the Internet Engineering Task Force, an open community that reviews and adopts standards.

That’s enough email for now. Let’s move on to the Web.

HTTP

HTTP stands for the hypertext transfer protocol. It’s a standard, just like SMTP. However, it’s designed to support sending data on the Web, not sending email.

Service-layer protocols are like that. They support specific types of communication. There are different protocols for instant messaging, mapping, gaming, and lots of other things. Hundreds of them. But to a Weber, only a few are important.

HTTP is maintained by the World Wide Web Consortium, another nonprofit standards group. The W3C is the most important standards group for the Web.

The setup is the same as before, with a client and a server. But this time, the client is a Web browser, and the server a Web server.

Web client and server

Figure 6. Web client and server

There are many Web browsers, including Firefox, Google Chrome, Safari, Opera, and Internet Explorer. We’ll use Firefox in our lessons, because it has nice features for Webers. We’ll talk about them as we go.

There are many Web servers as well. The most widely used is the Apache Web server. It runs on just about every computer there is, including Windows, Mac, and Linux.

So, HTTP is the set of rules that browsers and servers use to communicate. Browsers follow the rules when they talk to Web servers. Web servers follow the rules when they respond to Web clients.

Suppose Jake clicks on this link on a page:

Superdogs

Figure 7. Superdogs

Here’s the conversation between the browser and the server.

Client:
GET superdogs.html HTTP/1.1
Host: www.evildoom.com

Server:
HTTP/1.1 200 OK
Last-Modified: Mon, 25 Dec 2006 22:22:22 GMT
Content-Type: text/html
(Web page content)

HTTP says that clients should use GET to fetch content. Servers should use the code 200 to say that everything is OK. There’s lots more to HTTP, but you get the idea. HTTP is a set of rules that browsers and servers use to talk to each other.

Going deeper

  • HTTP headers. A short CoreDogs article on HTTP response headers.

Summary

In this lesson, you learned:

  • That a service is something one computer does for another.
  • How the email protocol SMTP works.
  • How the Web protocol HTTP works.

What now?

So a Web browser gets some data from a Web server. What does it do with the data? This will take us into the display layers, in the next lesson.


Lessons

User login


Dogs