Communication protocol problems in Java interview

Time:2021-1-27

HTTP
Internet Communication Protocol HTTP protocol is a state protocol. This means that all state is saved on the server side.
HTTP protocol ⾥ ⾯, four verbs indicating operation ⽅ form:GET、POST、PUT、DELETE
They correspond to four basic operations respectively. In short, get is to obtain resources, post is to create resources, put is to update resources, and delete is to delete resources.

Http1 and http2
Http1 is local transmission and http2 is binary transmission
HTTP 2 ⽀ holds multiple HTTP requests, and the flow ID is ⼀ HTTP requests. It is possible to transmit multiple HTTP requests
Http2 ⽀ actively push content to the client without the permission of the client

The programming protocol of Chang
TCP: transmission control protocol, three hold and four divide
UDP: user datagram protocol, suitable for transmitting only a small amount of data at a time, and the stability requirement is not satisfied
SPX: sequential packet switching protocol to ensure the integrity of data transmission, which is suitable for network and local game environment (anti terrorist elite and Starcraft)
NetBIOS: network transmission output system
TCP
Three times hold the message: (ACK and syn (ACK start response and syn start synchronization) are sent in the message
The client sends ⼀ messages with syn (syn send) flag to the server (request connection)
After receiving this message, the server sends back a message with syn (syn received) and ACK flag to the client
The client sends the message with ack flag to the server again (OK)

Four times: (when fin sends a notice, it only means that there is no data sent to you; but not all your data may be sent to you, so ACK and fin are sent separately in most cases.)
The client sends ⼀ fin flags to the server;
The server receives and returns ⼀ messages with ack flag, and confirms that the serial number is received serial number + 1;
The server closes the connection of the client and returns fin to the client;
The client returns ack confirmation and sets the confirmation sequence number to receive sequence number + 1;
sign
Closed: initial state
Listen: a socket of the server is in listening state, indicating that it can be connected
Syn received: the server received a message
Syn send: client sends message
Established: build connection
FIN_ WAIT_ 1: Ready to take the initiative to close the connection
FIN_ WAIT_ 2: Take the initiative to close the connection (but it means that there is still some data to be sent to you. Close it later)
TIME_ Wait: it means that it has received the fin message ⽅ for ⽅ and sent the ACK message ⽂ and it can return to closed after 2msl
But I’m in a good state. Because the fake network is unreliable, you can’t guarantee that the last ACK message you send will be received,
So time_ The operation of wait status is to resend the ACK message that may be lost
Closing: both are closing the socket
CLOSE_ Wait: waiting for shutdown
LAST_ ACK: passively close ⼀ ⽅ after sending fin message ⽂ and finally wait for ACK message ⽅. When the ACK message ⽂ is received, the
That is, you can enter the closed state.
It is possible for two emergency procedures to open at the same time, although it is less likely to open. But most of Berkeley’s
TCP / IP implementation does not always open at the same time.

3tcp (transmission control protocol) and UDP (home datagram protocol)
These two kinds of transmission modes are in the actual network programming, and the important data can be transmitted by TCP,
All the core data are transmitted by UDP

TCP/IP
TCP / IP means that TCP and IP work together.
TCP is responsible for the communication between Internet software (such as your browser) and Internet software.
IP is responsible for the communication between computers.
TCP is responsible for splitting data and loading IP packets, and then reassembling them when they arrive.
IP is responsible for sending packets to the receiver.
Socket
Class of network communication based on TCP protocol in Java

Supplement: the principle of AJAX is the asynchronous communication of HTTP protocol
Supplement: basic and important knowledge of Ethernet — OSI reference modelhttps://www.cnblogs.com/qishui/p/5428938.html

Recommended Today

SDS of redis data structure

SDS(simple dynamic string), simple dynamic string. S and it’s called hacking string. Where hack is stored is the length of the string and the remaining space in SDS. The implementation of SDS insds.cIn the middle. C language string uses a character array of length N + 1 to represent the string of length N, and […]