OSI seven-layer architecture Application layer Presentation layer Session layer Transport layer Network layer Data link layer Physical layer

You start at the physical level, you go through the data link layer, and then you go over the network to other computers to start the conversation, and then the presentation, and then the application

TCP TCP connection-oriented,UDP connectionless TCP byte stream oriented,UDP packet oriented,UDP has no congestion control, so network congestion does not slow down the source host transmission rate. The TCP header overhead is 20 bytes,UDP only 8 bytes TCP is more reliable but slower than UDP, which supports one-to-one, one-to-many, and many-to-many modes

Three or three handshakes

ACK: indicates the acknowledgement number. If the value is 1, the acknowledgement number is valid. If the value is 0, the packet contains no acknowledgement information and the acknowledgement number field is ignored.

SYN: Indicates the synchronization sequence number, which is used to establish a connection.

FIN: Finish flag, used to release the connection.

1. The client sends a packet with SYN=1, seq=X, and the port of the connected server. 2. The server replies with an ACK. That is, if the SYN flag bit and ACK flag bit are both 1, set the sequence number to X +1. And send a serial number of its own, y. 3. The client sends an ACK packet with the SYN bit set to 0 and the ACK bit set to 1. The client sends the Y +1 from the server as the ACK number and sets the sequence number to x+1.

Four or four handshakes

TCP connections are full-duplex, so each direction must be closed separately.

1. Client A sends A FIN to stop data transfer from client A to server B and sends an ISN (u) 2. Server B receives the FIN and sends back an ACK with the received FIN number plus 1 (u+1). At the same time, send an ISN(v) to client A. 3. Server B closes the connection with client A. Server B sends A FIN and ACK to client A. The confirmation number is the received sequence number plus 1 (U +1). 4. Client A sends an ACK packet and sets the sequence number of the ACK packet to the received sequence number plus 1 (W +1). The sequence number is the previous sequence number (U +1).

Five, the difference between symmetric encryption and asymmetric encryption 1 symmetric encryption: encryption and decryption with the same key, is not safe to be intercepted by hackers

Asymmetric encryption: public key encryption, private key decryption; The public key can be disclosed to others for encryption, and the private key is always in your possession, which is very secure and useless for hacking because the private key is not public. The famous RSA encryption algorithm uses asymmetric encryption.

HTTPS and HTTP

HTTP is a hypertext transfer protocol. HTTPS is a secure hypertext transfer protocol. It is a secure version of HTTP and uses secure Sockets Layer (SSL) for information exchange. HTTP+ Encryption + Authentication + Integrity Protection =HTTPS. HTTPS uses symmetric encryption. SSL is located between TCP at the application layer and TCP at the transport layer. Data is transferred from the application layer to the transport layer through SSL encryption.

HTTPS addresses the following deficiencies of HTTP:

Communication uses plaintext (not encryption), the content may be eavesdropped and the identity of the communicator is not verified. In this case, it may encounter camouflage and cannot prove the integrity of the message (i.e. accuracy), so it may have been tampered with