Chapter 23: Distributed Applications

 < Day Day Up > 



All the applications available on the Internet—electronic mail, file transfer, remote login, World Wide Web, and so on—are based on simple application layer protocols that run on the TCP/IP protocols. In this chapter, we will study the most widely used application layer protocols: SMTP and MIME for electronic mail, HTTP for the World Wide Web, and LDAP for directory services. We also will discuss SNMP for network management.

23.1 SIMPLE MAIL TRANSFER PROTOCOL (SMTP)

Simple Mail Transfer Protocol (SMTP) is used for electronic mail. E-mail consists of two parts: header and message body. The header is of the format

 To: kvkk.Prasad@ieee.org Cc:  wdt@bol.net.in Sub:  hello Bcc:  icsplted@hd1.vsnl.net.in 

The body consists of the actual message and attachments, if any. In general, the attachments can be text or binary files, graphics, and audio or video clips. However, SMTP supports only text messages.

SMTP uses information written on the envelope (message header) but does not look at the contents. However, SMTP handles e-mail with the restriction that the message character set must be 7-bit ASCII. MIME gives SMTP the capability to add multimedia features, as discussed in the next section. SMTP adds log information to the start of the delivered message that indicates the path the message took for delivery at the destination.

Note 

Every e-mail message contains a header that gives the details of the paths traveled by the message to reach the destination.

The SMTP mechanism is shown in Figure 23.1. There will be an SMTP sender and an SMTP receiver. A TCP connection is first established between the sender and the receiver.

click to expand
Figure 23.1: SMTP.

start example

SMTP is the application layer protocol for e-mail. SMTP handles mail with the restriction that the message should contain only ASCII text. Multimedia mail messages are handled by MIME, an extension to SMTP.

end example

SMTP sender: A user composes the mail message consisting of the header and the body and gives the message to the SMTP sender. The TCP connection between the sender and the receiver uses port 25 on the target host. When a mail is for multiple hosts, the SMTP sender sends mail to the destinations and deletes it from the queue, transfers all copies using a single connection, and then closes the connection.

If the destination is unreachable (a TCP connection cannot be established, the host is unreachable, or the message has a wrong address), the message is requeued for later delivery, and the SMTP sender gives up after a certain number of retries and returns an error message if attempts to retransmit fail.

Note that in the protocol, the SMTP sender's responsibility ends when message is transferred to the SMTP receiver (not when the user sees the message).

SMTP receiver: SMTP receiver accepts each message from the SMTP sender and puts the mail in the corresponding mailbox. If the SMTP receiver is a forwarding machine, it keeps the message in the outgoing queue. SMTP receiver should be capable of handling errors such as disk full or wrong user address.

start example

The format for the text message used in SMTP consists of the message ID, a header containing the date, from, to, cc, and bcc addresses, and the message body in ASCII text. This format is specified in RFC 822.

end example

SMTP protocol: The SMTP protocol uses the TCP connection between the sender and the receiver to transfer the messages. After the messages are transferred, the sender and receiver can switch roles: the sender can become the receiver to get the messages. SMTP does not include an acknowledgement to the message originator.

The format to be used for text messages in SMTP is specified in RFC 822. The format consists of:

  • Message ID: a unique identifier

  • Header: date, from, subject, to, cc, bcc

  • Message body in ASCII text

Note 

Web-based mail is used extensively mainly because it is provided as a free service by a number of service providers such as Hotmail and Yahoo!. In Web-based mailing systems, the HTTP protocol is used to connect to the server.

Application software to generate mail messages is not part of SMTP. It is an application program that runs above the SMTP.

SMTP commands are sent by the SMTP sender and replies are sent by the SMTP receiver.

start example

SMTP works as follows: A TCP connection is established between the sender and receiver using port 25. SMTP sender and receiver exchange a series of commands/responses for connection setup, mail transfer, and disconnection. Sender and receiver can switch roles for exchange of the mail.

end example

Some SMTP commands are:

HELO <space><domain><CR><LF>

to send identification

RCPT <space>To:<path><CR><LF>

identifies recipient of the mail

DATA <CR><LF>

to transfer message text

QUIT <CR><LFalso>

to close TCP connection

TURN <CR><LF>

reverse role of sender and receiver

MAIL <space>FROM<><CR><LF>

to identify originator

(CR stands for carriage return and LF for line feed.)

Some SMTP replies corresponding to these commands are given below.

Positive completion reply messages

220

<domain> Service ready

250

Requested mail action okay, completed the task

251

User not local, will forward mail

Positive intermediate reply

354

Start mail input, end with <CR><LF>

Transient negative replies

450

Requested mail action not taken, mailbox not available

451

Requested action not taken, insufficient disk space

Permanent negative replies

500

Syntax error, command unrecognized

501

Command not implemented

Using the above commands and replies, a typical SMTP session would be as follows. The session consists of three phases: connection setup, mail transfer, and disconnection.

Connection setup:

  1. Sender opens TCP connection with target host.

  2. Once connection is established, receiver identifies itself 220 service ready.

  3. Sender identifies itself with HELO command.

  4. Receiver accepts sender's identification: 250 OK.

Mail transfer:

  1. MAIL command identifies the originator of the message.

  2. RCPT command identifies the recipients of the message.

  3. DAT command transfers the message text.

    • If receiver accepts mail, 250 is sent.

    • If receiver has to forward the mail, 251 is sent.

    • If mailbox does not exist, 550 is sent.

    Disconnection:

  1. Sender sends QUIT command and waits for reply.

  2. Sender initiates TCP close operation.

Because SMTP messages have to be in the format specified in RFC 822, the SMTP mails will have the following limitations:

  • Executable files cannot be transmitted as attachments.

  • Text other than 7-bit ASCII cannot be transmitted.

  • SMTP servers may reject a mail message if it exceeds a certain size.

  • If two machines use different codes (such as ASCII and EBCDIC), translation problems are encountered.

  • SMTP cannot operate with X.400 MHS (message handling system), the standards specified for electronic mail in the ISO/OSI protocol suite.

  • There are nonstandard implementations of SMTP/RFC 822:

    • Deletion, addition, reordering of <CR< and <LF>

    • Truncation or wrapping lines longer than 76 characters

    • Padding of lines to the same length

    • Conversion of a Tab to multiple spaces

To overcome these limitations, the MIME protocol has been defined and runs above the SMTP.

Note 

X.400 message handling system is the standard application layer software for e-mail in the ISO/OSI protocol suite. It is a very sophisticated protocol that can handle registered mail, acknowledgments, and so on: SMTP, as the name implies, is simple and hence has limited features.



 < Day Day Up > 



Principles of Digital Communication Systems and Computer Networks
Principles Digital Communication System & Computer Networks (Charles River Media Computer Engineering)
ISBN: 1584503297
EAN: 2147483647
Year: 2003
Pages: 313
Authors: K V Prasad

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net