TCP / IP 7 application layer protocol

Chapter 8 application layer protocol

8.1 TCP / IP application layer protocol mainly refers to the fifth layer of the OSI reference model, layer 6, the upper half of the protocol layer 7. (Session layer, presentation layer, application layer)

Defined application-layer protocol:

Use of network applications are many, including web browser, e-mail, remote login, file transfer, network management. It enables these applications is the application specific communication protocol processing.

TCP and IP protocol is the underlying protocol does not depend on the type of upper layer application, very broad applicability. The application protocol is designed to achieve a certain application and protocol creation.

Application protocol and protocol layering:

Application can enjoy the base portion directly below the transport layer. As long as developers care about what kind of application protocol selection, how to develop can, without worrying about data application is sent to the target host and other issues in what way. This is also thanks to the credit of the network layer.

 

8.2 Telnet

Telnet is to achieve TSS (Time-Sharing System) environment , is the relationship between the host application and the terminal to a result on a computer network. TSS usually have a very strong ability to deal with the host. Around this host machines processing power of multiple terminals it is not as strong. These terminals are connected to the host via the dedicated line.

Log in from your local computer to the other end of the network application calculation function is called remote login.

The main use of Telnet and SSH TELNET two protocols.

8.2.1 TELNET

TELNET use a TCP connection , the connection to the host command to send files through this one and executed on the host. If the local user directly inside the shell-like remote host connected, directly operate locally.

TELNET can be divided into two basic classes of service. First, terminal emulation function, the second is the option negotiation mechanism .

TELNET is often used to log a router or other network equipment performance switch settings accordingly.

We need to own login user name and password when registering to the server via TELNET sign-on hosts or routers.

 

Options:

TELNET, in addition to processing text entered by the user, but also provide interactive and consultative function options. For example, to achieve emulation terminal (NVT, network virtual terminal) are used in the interface control information is sent through the option.

TELNET available rows or transparent mode two modes setting, also set by the optional function between the TELNET client and TELNET server.

Line mode: each client a new line from the keyboard, it sends the data row as an entire row to the server.

Transparent mode: each client must enter a character is sent to the server.

 

TELNET client:

Use the telnet command, telnet hostname TCP port number. So (telnet hostname 21) is equivalent to (ftp host name)

 

8.2.2 SSH

SSH is an encrypted remote login system. TELNET without having to enter a password to log in can be sent, likely to cause dangerous communications eavesdropping and illegal invasion. After communication content may be encrypted using SSH. Even if the information to be tapped can not crack the code sent, and what specific orders and the results returned by the command Yes.

SSH also includes many convenient features:

  1 ) You can use a stronger authentication mechanism

  2) can forward files

  3) You can use the port forwarding function

It refers to a port forwarding mechanism for forwarding the message received from a specific port number to a specific IP address and port number. Because through that part of the SSH connection is encrypted to ensure information security, it provides a more flexible communication.

The case of port forwarding, SSH client, SSH server program plays the role of a gateway.

 

8.3 File Transfer

FTP protocol is used for file transfer between two computers connected. FTP also need to be appropriate after you log in to each other's computers.

There is a FTP server that allows anyone to access on the Internet, this server is called anonymous server. Or use anonymous ftp can logon servers.

FTP working mechanism Summary:

FTP file transfer is to be realized through what mechanism it? It uses two TCP connections: one for control and one for transmission of data (files).

Used for controlling the TCP connection is mainly used in the control section of FTP. Such as verifying username and password, send the name of the file, set the transmit mode. With this connection, ASCII characters can send requests and receive responses. TCP can not send data on this connection, the need for a dedicated data connection.

FTP control connection uses TCP port 21. GET files 21 on the TCP port number, PUT, and the file list when the other operations, each time establishing a TCP connection for data transmission. List of transmission and transmission of data files is precisely in this new connection. After the transmission is complete, this data transmission connection will be disconnected, and processing continues in the command response or control connection.

Connection control, user requirements prior to disconnecting state will remain connected. However, the vast majority of FTP server without any user will be connected to the input of a new command to forcibly disconnect for a long time.

TCP connection for data transmission port 20 is typically used. But can be changed to other values ​​PORT command. For safety reasons, generally allocated port number using a random number in the data transmission.

 

Interactive processing performed by an ASCII string:

FTP request command using the "RETR" like an ASCII string. Response against the use of these commands, such as "200" and three-digit ASCII characters. TCP / IP protocol, there are many applications that use the protocol of an ASCII string.

For the ASCII string of the agreement is of great significance wrap. In many cases, the string representation represents a command line or a response, and a blank is used to identify the delimiter between parameters. That is, by the command and response message wrap distinguished, separated by a space parameters. Wrap the "CR" and "LF" two control symbols.

 

8.4 E-mail

8.4.1 working mechanism email

Email services agreement is called SMTP. SMTP order to achieve efficient transmission message content, using the TCP protocol in the transport layer thereof.

Early use of the transmitting end and the receiving end initiates a TCP connection established directly send data. However, this will be some problems, the host is not always open, private IP hosts in different subnets can not communicate directly and so on.

Later, the introduction of the e-mail server for up will connect the power supply. For the sending and receiving mail through the mail server. Receiver uses the POP3 protocol when receiving mail from the mail server.

Email mechanism consists of three parts, which are a mail address, data format and transmission protocol.

 

8.4.2-mail address

Need to have when using the e-mail address is called the e-mail address. It corresponds to the communication address and name.

Internet e-mail address format is as follows:

  Name @ Mailing address

Now, e-mail address to send managed by the DNS . E-mail address is registered in DNS as its domain mail server when sending correspondence address. The map information is called MX record.

 

8.4.3 MIME

Over a long period of time, the Internet can only handle e-mail messages in text format. But now, the type of data that can be sent by e-mail that has been extended to MIME, you can send various forms of static images, animations, sounds, programs and other data. In view of the MIME format of the application of a predetermined message, so that it corresponds to the OSI reference model Layer 6 Presentation Layer.

MIME is basically composed of a header and body (data) of two parts. The first part can not be a blank line, because once the blank line, followed by the appearance will be considered part of the text (data). If the MIME header "Content-Type" specifies "Multipart / Mixed", and to "boundary =" character as a separator behind, it may be combined into a plurality of MIME message MIME message. This is called multipart. I.e., the various parts of the body and by the MIME header (data) composition.

"Content-Type" defines the data type followed by the header information. To the IP header, for example, it is equivalent to the protocol field. It can represent text, images, animations, and many other types.

 

8.4.4 SMTP

SMTP is a protocol for sending e-mail. It uses TCP port 25 is good. SMTP establish a TCP connection after the response, and transmission and control data on the connection. Client makes a request in the form of text, the server returns a three digit responses.

Each of the commands and responses must be added last line feed command (CR, LF).

When allowed to log in the SMTP server TELNET, may be used: telnet server name or IP address 25

 

8.4.5 POP

Mentioned in the previous section SMTP is a protocol to send mail, that is the computer you want to send mail SMTP is a protocol for sending e-mail to a computer to receive mail.

Long-term PC is turned off, when users boot. In this case, people want a boot will be able to receive mail. However, SMTP is no such mechanism. One disadvantage is that it supports SMTP is the behavior of the sending host, instead of sending a request message according to the receiving end.

To solve this problem, on the introduction of POP protocol. The protocol is a protocol for receiving email. The transmission side mail SMTP protocol will be forwarded to the POP server has been in the plug-in state. The client then accept each other incoming mail from a POP server based on the POP protocol. In this process, in order to prevent others from stealing mail content, but also for user authentication.

POP and SMTP as a TCP connection is completed between the respective operations by setting up the client and the server. POP specific commands are short ASCII characters, the response has "+ OK" and "-ERR" two kinds.

When allowed to log in to the POP server using TELNET, may be used: telnet POP server name or IP address 110

 

8.4.6 IMAP

IMAP and POP similar, but also receive e-mail protocol. Managed by the client POP mail, and IMAP mail is managed by the server.

When using IMAP, you do not have to download all the messages from the server can read. Since IMAP is a MIME message processing server, it can be realized when a message contains attachments 10 "only download attachments 7 which" function. It plays a very important role in the narrow bandwidth lines. And IMAP for "read / unread" messages on the server and information classification management, therefore, open the mailbox even on different computers, but also to keep pace, very convenient to use . Use IMAP, store and manage e-mail messages on the server, just as manage their information in their own local client as simple as a flash memory.

IMAP provides a very convenient environment for people to use a variety of heterogeneous terminals.

 

8.5 WWW

World Wide Web (WWW, world wide web) is the information in the Internet show in the form of a hypertext system. Also called web. The client software can display the WWW information is called a web browser.

With a browser, it is not necessary to consider the information which is stored in the server, need only click of a mouse you can access the link on the page and open the relevant information.

8.5.2 WWW basic concepts

WWW defines three key concepts, namely, the means and location for accessing information (URI, uniform resource identifier), forms of information (HTML, HTML) and the information forwarded (HTTP, the Hypertext Transfer Protocol) and other operations .

 

8.5.3 URI

Uniform resource identifier for identifying resources. URI is an identifier can be used to efficiently than WWW, which is used in various combinations home address, email address, telephone number, and the like.

URL (uniform resource locator) Uniform Resource Locator, the Internet is used to identify the specific location of the resource (file). URI but not limited to identifying Internet resources, it can be used as identification codes of all resources.

The specific format of the URI http scheme is as follows:

  http: // hostname / path

  http: // hostname: port number / path

  http: // hostname: port number / path? Access some of the information content #

Where the host name identifies the domain name or IP address, port number identifies the transmission port number. http default port number is 80 . Path is the location of the information on the host, access to the content identification information to be passed to the CGI, which indicates the position of the part of the information page and the like.

This representation may uniquely identify a specific Internet data. However, as demonstrated by the data are http program may change at any time, so even if the URI remember your favorite pages, we can not guarantee that the next but also access to the page.

 

8.5.4 HTML

HTML is written in one language web page (data format). It can specify the text, text size and the color display in the browser. Further, not only the relevant settings for image or animation, you can also set the audio content.

HTML has the function of plain text. In the pages not only for the additional link text or image, when users click on those links, you can have presented the contents of the links as indicated . The vast majority of the Internet web page are links to other related information in the form of a link. One by one point to open these links can understand the information.

HTML can also be said that the performance of WWW universal data protocol. Even on heterogeneous computer, as long as it can show the HTML data, then the effect is substantially the same. If it corresponds to the OSI reference model, it may be considered to belong to the WWW HTML presentation layer. However, in view of the presentation layer of modern computer networks is not yet foolproof ready, may differ slightly depending on the operating system and software used by different, and ultimately manifested effect.

 

8.5.5 HTTP

When the user input in the address bar of the browser to access the URI web pages, HTTP processing begins. The default HTTP port 80. Its working mechanism, first client establishes a TCP connection to the server's port 80, and then send the request and response packets on this TCP connection .

HTTP commonly used in two versions, a HTTP1.0, and the other is HTTP1.1. In HTTP1.0 each command and response will trigger the establishment of a TCP connection and disconnection. HTTP1.1 from the beginning, the TCP allows the connection to a plurality of transmitting commands and responses. Accordingly, substantially reduced the establishment of the TCP connection and disconnection operations, thereby improving efficiency.

When the HTTP server and allow TELNET connection, the HTTP server can log in the form, and then manually performing an HTTP command form.

telnet server name or IP address 80

 

8.5.6 JavaScript、CGI、Cookie

JavaScript: the basic elements of Web URI, HTML and HTTP. However, these can not only change the dynamic content consistent with conditions. JavaScript is a programming language embedded in HTML, as a client program can run on many types of browsers. These embedded HTML browser will download the JavaScript, which corresponds to the JavaScript program can be implemented on the client.

 

CGI: CGI is a specification of a service-side web server when calling external programs used by the application.

General data communications web, but according to the client requests stored in the web server forwards only the hard disk. Information each harvest client in this case is the same (static) content. And after the introduction of CGI client request triggers the web server running another program, the client entered data will be passed to the external program. After running the program ends generated HTML and other data back to the client.

The use of CGI can be returned for a user to operate a wide variety of client information changes (dynamic). Forums and online shopping systems CGI call an external program or access the database often use.

 

Cookie: web application in order to obtain user information using mechanisms called Cookie's. web server with Cookie saving information (mostly "user name" and "login" and other information) on the client. Cookie is often used to save login information or product information online shopping into a shopping cart.

Cookie from the web server checks to confirm if the same correspondent node. Thus stored in the shopping cart of merchandise information is necessary to save in the server.

 

8.6 Network Management

TCP / IP network management can use SNMP to collect the necessary information. It is a UDP / IP-based protocol.

 

Other application layer protocols 8.7

8.7.1 Multimedia Communication Protocol

8.7.2 P2P

E-mail communications over the Internet, generally belonging to a server corresponding to a plurality of clients C / S mode, i.e., 1 N morphology of the communication.

In contrast, terminals or hosts on the network 1 is not directly known P2P (peer to peer) of the case communicate with each other via a server. This is like using a wireless transceiver one on one conversation. P2P host with client and server functions both to provide services of a peer relationship with each other.

IP phones are also examples of the use of P2P. You are P2P after use, can be dispersed to the network load caused by the audio data, more efficient use. For example on the use of the Internet phone Skype's P2P function.

In addition to point IP completely apart, other implementations of the Internet file transfer application or part of a group, such as the BitTorrent protocol software is also used to P2P technology.

 

Guess you like

Origin www.cnblogs.com/cjj-ggboy/p/12505568.html