Computer network--seven layer Protocol/Five layer protocol

Source: Internet
Author: User
Tags character set html header resource port number

"OSI layer Seven Protocol"


Application Layer

An application that communicates with other computers, which is the communication service of the corresponding application. For example, a word processor without a communication function would not be able to execute the code of communication, and the programmer working on the word processing did not care about the 7th layer of the OSI. However, if you add an option to transfer files, the programmer of the word processor will need to implement the 7th layer of the OSI. Example: Telnet,http,ftp,nfs,smtp and so on.

Presentation Layer

The main function is to define the data format and encryption. For example, FTP allows you to choose to transfer in either binary or ASCII format. If binary is selected, the sender and receiver do not change the contents of the file. If you select ASCII format, the sender converts the text from the sender's character set to the standard ASCII and sends the data. Converts standard ASCII to the receiver computer's character set on the receiver side. Example: Encryption, ASCII, and so on.

Session Layer

Defines how to start, control, and end a session, including control and management of multiple two-way messages, so that the app can be notified when only part of a continuous message is completed, so that the data that the presentation layer sees is contiguous, and in some cases, data represents the presentation layer if all the data is received by the presentation layer. Example: Rpc,sql and so on.

Transport Layer

The functionality of this layer includes whether to choose the error recovery protocol or the error-free recovery protocol, and to reuse the input of data streams from different applications on the same host, as well as the reordering of packets that are not received in the wrong order. Example: Tcp,udp,spx.

Network Layer

This layer defines the end-to-end package transport, which defines the logical addresses that identify all nodes, and defines how and how the routes are implemented. To accommodate transmission media with a maximum transmission unit length of less than the packet length, the network layer also defines a segmentation method that decomposes a packet into smaller packets. Example: Ip,ipx and so on.

Data Link Layer

It defines how data is transferred on a single link. These protocols are related to the various media being discussed. Example: Atm,fddi and so on.

Physical Layer

The OSI Physical layer specification is a characteristic standard for transmission media that is often referenced by other organizations ' standards. Connection head, frame, frame use, current, encoding and light modulation are all the contents of various physical layer specifications. The physical layer often uses multiple specifications to complete the definition of all the details. Example: rj45,802.3 and so on.

"TCP/IP layer five protocol"


"HTTP Protocol"

The HTTP protocol (hypertext Transfer Protocol, Hypertext Transfer Protocol) is the transfer protocol used to transfer the text from the WWW server to the local browser. It can make the browser more efficient and reduce the network transmission. It not only ensures that the computer transmits hypertext documents correctly and quickly, but also determines which part of the document is being transmitted, and which content is displayed first (such as text before graphics), and so on.

HTTP is an application-layer protocol, consisting of requests and responses, always a client-initiated request, a server loopback response, and a standard client-server model.

HTTP is a stateless protocol, and there is no correspondence between this request and the last request of the same client.

An HTTP operation is called a transaction, and its working process can be divided into four steps:

1) First the client and the server need to establish a connection. As soon as you click on a hyperlink, the HTTP work begins.

2) After the connection is established, the client sends a request to the server in the form of a Uniform Resource Identifier (URL), protocol version number, followed by MIME information including the request modifier, client information, and possible content

3) When the server receives the request, it gives the corresponding response information in the form of a status line, including the protocol version number of the information, a successful or incorrect code, followed by MIME information including server information, entity information, and possible content.

4) The information returned by the client receiving server is displayed on the user's display by the browser, and then the client disconnects from the server. If an error occurs in one of the steps above, the information that generates the error is returned to the client, with the display output. For the user, these processes are done by HTTP itself, the user just click with the mouse, waiting for information to display it.

Common Request Methods

The common request method is get and post.

Get mode: Is the information of the resource specified by the request URL as an entity, and if the request URL is just a data generation process, then the final return in the response entity is the resource to which the result of the processing is directed, not the description of the processing process.
Post mode: Used to make a request to the destination server that it accepts the entity attached to the request and treats it as an additional new subkey for the resource specified by the request URI in the request queue, and post is designed to implement the following functions in a uniform way:

1: Interpretation of existing resources;

2: Send messages to bulletin boards, newsgroups, mailing lists, or similar discussion groups

3: Submit data block;

4: Extend the database with additional operations.

As can be seen from the above description, get is a request to the server for data, and post is a request to submit data to the server, the data to be submitted is in the entity behind the information header.

the Get and post methods have the following differences:

(1) On the client side, the Get method submits the data through the URL, the data can be seen in the URL, the Post method, and the data is placed within the HTML header submission.

(2) The data submitted by the Get method can only have up to 1024 bytes, while post does not have this limit.

(3) Security issues. As mentioned in (1), when you use Get, the parameters are displayed on the address bar, and Post does not. So, if the data is in Chinese and is non-sensitive, then use get; If the user enters data that is not a Chinese character and contains sensitive data, then it is better to use post.

(4) Safe and idempotent. The so-called security means that the operation is used to obtain information rather than modify information. Idempotent means that multiple requests to the same URL should return the same result. The complete definition is not as strict as it seems. In other words, GET requests generally should not have side effects. Fundamentally, the goal is that when a user opens a link, she can be confident that the resource has not changed from its point of view. For example, the front page of news sites is constantly being updated. Although the second request returns a different batch of news, the operation is still considered safe and idempotent, as it always returns the current news. Vice versa. The POST request is not that easy. POST represents a request that might change resources on the server. Still take the news site as an example, the reader's comments on the article should be implemented through the POST request because the site is different after the annotation is submitted (for example, an annotation appears below the article).

Cookies and Session

Both the cookie and the session are used to save state information, which is a mechanism for preserving the state of the client, and they are all efforts to resolve the problem of HTTP stateless.

Sessions can be implemented with cookies, or by the mechanism of URL writeback. A session that is implemented with cookies can be considered a more advanced application of cookies.

There are obvious differences between the cookie and the session :

1) The cookie saves the state on the client, and the session saves the State on the server side;

2) Cookies are small pieces of text that the server stores on the local machine and are sent to the same server with each request. Cookies were first implemented in RFC2109, and subsequent RFC2965 were enhanced. The Web server sends cookies to the client using HTTP headers, and in the client terminal, the browser parses the cookies and saves them as a local file, which automatically binds any requests from the same server to these cookies. The session is not defined in the HTTP protocol;

3) session is for each user, the value of the variable is saved on the server, with a sessionid to distinguish which user session variable, this value is accessed by the user's browser when the server is returned, when the customer disables the cookie, This value may also be set to be returned to the server by get;

4) As far as security is concerned: when you visit a site that uses a session and create a cookie on your own machine, it is recommended that the session mechanism on the server side be more secure. Because it does not arbitrarily read the information stored by the customer.

HTTPS

HTTPS (hypertext Transfer Protocol over secure Socket Layer) is a security-targeted HTTP channel and is simply a secure version of HTTP. That is, the SSL layer is added under HTTP, the security base of HTTPS is the port number used by Ssl,https is 443.

"TCP Layer"

TCP (transmission Control Protocol Transmission Protocol) is a connection-oriented, reliable, byte-stream-based Transport layer communication protocol. The TCP layer is the middle tier located above the IP layer and below the application layer. There is often a need for reliable, pipe-like connections between the application tiers of different hosts, but the IP layer does not provide such a flow mechanism, but rather provides unreliable packet switching.

The application layer sends a 8-byte data stream for inter-network transmission to the TCP layer, and then TCP partitions the data stream into a segment of the appropriate length (which is usually limited by the MTU of the maximum transmission unit of the Data link layer of the network to which the computer is connected). TCP then passes the result packet to the IP layer, which transmits the packet over the network to the TCP layer of the receiving side entity. TCP in order to ensure that no packet loss occurs, give each packet a sequence number, while the serial number also guarantees the delivery to the receiving end of the entity's packet received sequentially. The receiving entity then sends back a corresponding acknowledgment (ACK) to the packet that was received successfully, and if the sending entity does not receive a confirmation within a reasonable round trip delay (RTT), then the corresponding packet is assumed to be lost and will be re-transmitted. TCP uses a checksum function to verify the data for errors, and to calculate checksums when sending and receiving.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.