|
This is an unpolished draft of the third edition of this e-book. If you find any error or have suggestions to improve the text, please create an issue via https://github.com/CNP3/ebook/issues?milestone=3 or help us by providing pull requests to close the existing issues.
|
Ceci est une ébauche non révisée de la troisième édition de cet e-book. Si vous trouvez une quelconque erreur ou avez des suggestions pour améliorer ce texte, n'hésitez pas à envoyer une issue via https://github.com/CNP3/ebook/issues?milestone=3 ou aidez-nous en fournissant une pull request afin de clore les issues existantes.
|
|
Applications
|
Applications
|
|
Networked applications do not exchange random messages. In order to ensure that the server is able to understand the queries sent by a client, and also that the client is able to understand the responses sent by the server, they must both agree on a set of syntactical and semantic rules. These rules define the format of the messages exchanged as well as their ordering. This set of rules is called an application-level `protocol`.
|
|
|
An `application-level protocol` is similar to a structured conversation between humans. Assume that Alice wants to know the current time but does not have a watch. If Bob passes close by, the following conversation could take place :
|
|
|
Alice : `Hello`
|
Alice : `Hello`
|
|
Bob : `Hello`
|
Bob : `Hello`
|
|
Alice : `What time is it ?`
|
Alice : `Quelle heure est-il ?`
|
|
Bob : `11:55`
|
Bob : `11:55`
|
|
Alice : `Thank you`
|
Alice : `Merci`
|
|
Bob : `You're welcome`
|
Bob : `Avec plaisir`
|
|
Such a conversation succeeds if both Alice and Bob speak the same language. If Alice meets Tchang who only speaks Chinese, she won't be able to ask him the current time. A conversation between humans can be more complex. For example, assume that Bob is a security guard whose duty is to only allow trusted secret agents to enter a meeting room. If all agents know a secret password, the conversation between Bob and Trudy could be as follows :
|
|
|
Bob : `What is the secret password ?`
|
|
|
Trudy : `1234`
|
Trudy : `1234`
|
|
Bob : `This is the correct password, you're welcome`
|
|
|
If Alice wants to enter the meeting room but does not know the password, her conversation could be as follows :
|
|
|
Alice : `3.1415`
|
Alice : `3.1415`
|
|
Bob : `This is not the correct password.`
|
Bob : `Ce n'est pas le bon mot de passe.`
|
|
Let us first discuss the syntactical rules. We will later explain how the information flow can be organized by analyzing real networked applications.
|
|
|
Application-layer protocols exchange two types of messages. Some protocols such as those used to support electronic mail exchange messages expressed as strings or lines of characters. As the transport layer allows hosts to exchange bytes, they need to agree on a common representation of the characters. The first and simplest method to encode characters is to use the :term:`ASCII` table. :rfc:`20` provides the ASCII table that is used by many protocols on the Internet. For example, the table defines the following binary representations :
|
|
|
`A` : `1000011b`
|
|