[Basic] computer computer network

First, enter the URL returned from the process to the page

  1. DNS to find the corresponding IP address of the domain names;
  2. The server sends a Request;
  3. Server receives the request, and processing returns Response;
  4. Related Resources Download page (such as images, CSS stylesheets, JS files, etc.) and displays the response content.

Two, Http and Https

1, the basic concepts of HTTP and HTTPS
  • HTTP (HyperText Transfer Protocol, Hypertext Transfer Protocol): is the Internet's most widely used network protocol, a client and a server-side request and response standard (TCP), for transmission from the WWW server to the local hypertext the transport protocol browser, the browser can make it more efficient, so reducing the network transmission;
  • HTTPS (Secure Hypertext Transfer Protocol, Hypertext Transfer Protocol): is safe for the target HTTP channel, simply, it is a safe version of HTTP, HTTP added SSL layer, HTTPS is SSL security infrastructure, therefore encryption details We need SSL. The main role of the HTTPS protocol can be divided into two types: one is to establish a channel of information security, to ensure the security of data transmission; the other is to confirm the authenticity of the site.
2, the difference between HTTP and HTTPS
  • CA https protocol need to apply for a certificate, generally less free certificates, thus requiring a fee;
  • http hypertext transfer protocol, information is transmitted in the clear, https is encrypted with a security ssl transfer protocol;
  • http and https use is completely different connections, with the port are not the same, the former is 80, which is 443;
  • Http connection is very simple, is stateless; is constructed by the HTTPS protocol SSL + HTTP encrypted transmission protocol, a network authentication protocol, the http protocol than security.
3, Https works
  1. The client uses https to access the server, the request to establish an SSL connection to the Web server;
  2. After the server receives a client request, the certificate information will be the site (containing the public key) to the client;
  3. The client browser and server negotiate a secure SSL connection level, that is, information encryption level;
  4. According to the client browser security levels agreed to establish a session key, and then use the site's public key to encrypt the session key and send it to the site;
  5. Server use their private key to decrypt the session key;
  6. Using the communication between the server session key encrypted with the client.
4, Https advantage
  • May authenticate the user and the server, it transmits the data to ensure that the correct client and the server;
  • Encrypted transmission protocol HTTPS is constructed by SSL + HTTP protocol, a network authentication protocol, the http protocol than security, to prevent data from being stolen during transmission, changes to ensure data integrity;
  • HTTPS is under the existing framework of the most secure solution, though not absolutely safe, but a substantial increase in the cost of the middleman attacks;
  • Google search engine algorithm was adjusted in August 2014, saying "Compared to the same HTTP sites using HTTPS encrypted site's ranking in search results will be higher."

 Three, TCP / IP

1, TCP / IP basic concepts

TCP / IP protocol is the most basic Internet Protocol, wherein the main application layer protocol has the Telnet , the FTP , the SMTP , is used to receive data from the transport layer or a different application requirements and methods to transmit data to the transport layer; transport layer the main agreement the UDP , the TCP , the user is bound to the internal data and the computer information network using the internet channel, data transmission can be achieved and data sharing; main protocol network layer has the ICMP , the IP , the IGMP , is mainly responsible for the packet network transmitting the like; and the network access layer, also called the network layer or data link layer interfaces, protocols are mainly the ARP , the RARP , the main link management function is to provide error detection, efficient processing of different communication media and other information about details.

Composition 2, TCP / IP protocol
  • Application Layer: The application layer is the first layer TCP / IP protocol is to provide services directly to the application process.
    1. They will use a different application layer protocols for different types of applications according to their needs, the use of SMTP mail transfer protocol application, web application uses HTTP protocol, remote login service applications have used TELNET protocol;
    2. The application layer also encryption, decryption, data format;
    3. The application layer can create or remove links with other nodes, so as to fully save network resources.
  • Transport Layer: As a TCP / IP protocol in the second layer, the transport layer acts as a mainstay in the entire TCP / IP protocol. And transport layer, TCP and UDP also played a pillar of. 
  • Network layer: The network layer is the third layer in the TCP / IP protocol. The network layer may be established and the IP address and look for termination of the network connection functions such as the TCP / IP protocol. 
  • Network Interface Layer: In the TCP / IP protocol, the network interface layer in the fourth layer. Since the network interface layer merged physical layer and data link layer so that the physical network interface layer both media data transmission, can also provide an accurate line network layer.

Four, TCP and UDP

1, TCP basic concepts

UDP protocol defines a port, the same application on each host to specify a unique port number, and a predetermined data packet transmission network port information must be added, When the packet arrives at the host, can be found according to the port number corresponding application. UDP protocol is relatively simple and easy to implement, but it did not confirm the mechanism, packet once issued, can not know if it was received, and therefore less reliable, in order to solve this problem, improve network reliability, TCP protocol was born.

2, UDP basic concepts

TCP Transmission Control Protocol, a connection-oriented, reliable byte stream protocol based communication. In simple terms is to have the UDP protocol TCP acknowledgment mechanism, each sends a data packet asked to confirm, if a packet is lost, it can not receive confirmation, the sender must retransmit the packet. In order to ensure the reliability of transmission, TCP protocol to establish a mechanism to confirm the three dialogues in UDP basis, that is, before the official send and receive data, you must create a reliable connection and each other. TCP and UDP packets, are composed of a header and a data portion composed of two parts, the only difference is, the length of the TCP packet is not limited, and can be theoretically infinite, but in order to ensure the efficiency of the network, typically the length of the TCP packet is not over IP packet length, to ensure a single TCP packet does not have to re-segmentation.

3.TCP3 handshake and waved four times

3-way handshake TCP connection:

  1. Flag data segment contains a host A synchronous serial number by sending host B to host B, B to establish a connection request to the host through the data segment, Host A Host B to tell two things: I want you and communications; the serial number which you can use to respond to me as a starting data segment;
  2. After the host B host A's receipt of the request, with a reply with a confirmation ( ACK ) and synchronous serial number ( the SYN segment) flag in response to Host A, Host A also told two things: I have received your request , you can transfer the data; you use the serial number as the initial data segment to respond to me;
  3. After Host A receives the data segment, and then sends an acknowledgment reply confirming the receipt of the data segment host B: "I have received a reply, I now want to start the actual data transmission.

TCP disconnect fourth wave:

  1. A when the host data transfer is complete, the control bit is set to 1 FIN, the TCP connection request to stop the proposed;
  2. After receiving the FIN host B in response thereto, to confirm the TCP connection will be closed in that direction, the ACK is set;
  3. The B end then requests made off in the opposite direction, the FIN is set;
  4. Host A requests the host B to be confirmed, it is set to ACK, both to the closed end.

Five, GET and POST

Only HTTP GET and POST request methods of two protocol (similar to), and the HTTP protocol is TCP / IP based application layer protocol, regardless of GET or POST, with a transport layer protocol are the same, so the transmission, there is no difference .

  • The packet format, with no parameters, the biggest difference is the first line of the method name, just different packets of a few characters only. POST method request packet is such that a first row POST / url HTTP / 1.1 GET method request message is a first line GET / url HTTP / 1.1;
  • With the difference parameter Times article, in agreement, the parameters of the GET method should be placed in the url, POST method parameters should be placed in the body.
  GET POST
Back button / Refresh harmless Data will be re-submitted (the browser should inform the user that the data will be re-submitted).
Bookmark Can be bookmarked Not bookmarked
Cache Be cached You can not cache
Encoding type application/x-www-form-urlencoded application / x-www-form-urlencoded or multipart / form-data. The use of multiple encoded binary data.
history Parameters remain in the browser history. Parameters are not saved in the browser history.
Restrictions on data length Yes. When transmitting data, GET method to add data to the URL; URL length is limited (maximum length of the URL is 2048 characters). Unlimited.
Restrictions on data type Allows only ASCII characters. no limit. Also allows binary data.
safety

Compared with POST, GET poor security, because the data sent is part of the URL.

When sending passwords or other sensitive information should never be used GET!

POST is more secure than GET, because the parameters are not saved in the browser history or web server logs.
Visibility Data in the URL is visible to all. Data is not displayed in the URL.

Sixth, flow control and congestion control

1. The basic concept of flow control

If the sender send data too fast, too late to the recipient receiving, there will be packet loss. To avoid packet loss, the sender transmits a control speed so that the recipient received in time, that is, the flow control. The fundamental purpose is to prevent the flow control packet loss, it constitutes one hand the reliability of TCP.

2. The flow control works

A sliding window protocol ( continuous ARQ protocol ) implemented. Sliding window protocol ensures that only error-free packet, receiving ordered, flow control is also achieved. The main way is ACK returned by the receiver contains its own receive window size, and the size of control data transmitted using the transmission side.

3. Flow Control Cause and Solution cause deadlock

When the sender receives a reply window, under the sender will stop sending, wait for the receiver of a zero response. But if the window is not to answer 0 lost during transmission, the sender wait forever, while the recipient that the sender has received this response, waiting to receive the new data, so the two sides wait for each other, resulting in a deadlock.
In order to avoid deadlock caused by the flow control, TCP uses a timer duration. Whenever the sender receives a zero window of response after starting the timer. Time they take the initiative to send a message asking the consumer window size. If the receiver still returns zero window, then reset the timer continues to wait; if the window is not zero, it indicates that the response packet is lost, then began sending reset after sending window, thus avoiding the generation of deadlock.

4. Congestion Control

Guess you like

Origin www.cnblogs.com/6970-9192/p/11392286.html