Java中Http和Socket是什么关系?
黄舟
黄舟 2017-04-18 10:26:59
0
4
368

Java中Http和Socket是什么关系?

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(4)
伊谢尔伦
  1. First of all, there is a problem with the statement that socket is a long connection. Socket is an intermediate software abstraction layer for communication between the application layer and the TCP/IP protocol family. It can use either the underlying TCP or UDP. Http is based on TCP. The long connections and short connections of the HTTP protocol are essentially the long connections and short connections of the TCP protocol.

  2. Long connections and short connections are relative.
    Long connection: After establishing a connection, it is maintained for a period of time. During this period, multiple requests and responses use this connection.
    Short connection: Each time a request is made, a connection is established, and the connection is closed when the server responds.

  3. HTTP/1.0 is a short connection, HTTP/1.1 supports long connections, and HTTP/2 has been improved. What is the need behind these improvements? Recommended history of HTTP

PHPzhong

To be precise, HTTP is based on TCP/IP.

TCP/IP can be long or short, while HTTP mainly uses it as short.

HTTP can also be long, as long as the server and browser do not close the link all the time. This method was once popular to achieve real-time server notification (search http comet to find out).

洪涛

HTTP just "does not require" long connections. You can keep it alive or close the socket immediately after the transmission is completed. There is no problem.

左手右手慢动作

Before asking [why], please research clearly [whether it is]!

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template