Would you like to make this site your homepage? It's fast and easy...
Yes, Please make this my home page!
Connected: An Internet Encyclopedia
ASCII Request/Reply Protocols
Up:
Connected: An Internet Encyclopedia
Up:
Topics
Up:
Concepts
Up:
Protocol
Prev: Protocol
Next: ASN.1
ASCII Request/Reply Protocols
ASCII Request/Reply Protocols
ASCII Request/Reply protocols include FTP, HTTP,
SMTP, POP, IMAP and others.
They all run over reliable stream connections (TCP), and
are designed to be usable by either a program or a human
(usually for testing purposes).
They all feature the following common attributes:
- Asymmetric client/server.
Two parties participate in the protocol, a client and a server.
The server listens on a well-known TCP port number, and clients
connect to the server. The client is always the party
initiating the TCP connection.
The connection is asymmetric - the client and server use different
message vocabularies; the client issuing commands and
the server sending replies.
- ASCII Messages.
Each message is a single line of ASCII text, ending with a CR/LR
combination. For client commands, the message begins with
a English or English-like command verb, followed optionally
by a space and zero or more parameters. For server responses,
the message begins with a three digit numeric response code,
followed by English text explaining the response.
Multi-line messages can be sent in several ways. For example,
the SMTP specification allows the client to send a DATA
command, which indicates that a mail message follows.
The mail message is transmitted on successive lines, until a
line containing only a single period is received. This is the
end-of-message indicator. An escape mechanism is provided
to send mail messages containing lines with single periods in them.
- Numeric reply codes.
In server replies, the three digit numeric code is designed to
be interpreted by software, while the English text that follows
is meant for human consumption. The first digit (hundreds position)
indicates the general class of reply. For example, in HTTP,
the server sends 2xx for success, 4xx for
client error, 5xx for server error.
In server replies, if the first character following the numeric
response code is a dash (instead of a space), it typically indicates
a multi-part reply.
Protocols need not strictly confirm to this outline. For example,
the IMAP protocol introduces the idea of tagged commands
and replies. Each client command is prefixed with a tag, which
the server echos back in the reply, allowing replies to be
matched to commands.
ASCII request/reply protocols use the underlying TCP protocol
to provide flow control and windowing.
A state machine, specified as part of the protocol,
typically sequences the messages.
Timers on both the client and server place an upper limit
on how long each will wait for a message from the other side,
disconnecting the session if it becomes hung.
RFC 821 includes several
sample SMTP sessions
which illustrate how this kind of protocol operates.
Next: ASN.1
Connected: An Internet Encyclopedia
ASCII Request/Reply Protocols