Thomescai http://blog.csdn.net/thomescai (reprinted please keep)
Summary:
I was a little confused about these concepts. I checked some materials and summarized their differences. If any error occurs, take a picture ~~~
First look at the figure:
What is TCP/IP?
TCP/IP is a protocol group, which can be divided into three layers: network layer, transport layer and application layer.
The IP protocol, ICMP protocol, ARP protocol, RARP protocol, and BOOTP protocol are available at the network layer.
There are TCP and UDP protocols in the transport layer.
The application layer includes FTP, HTTP, telnet, SMTP, DNS, and other protocols.
What is socket?
Socket is an intermediate software abstraction layer for communications between the application layer and TCP/IP protocol families. It is a set of interfaces that hide complex TCP/IP protocol families behind the socket interface.
So HTTP isTCP/IP application layer protocol.Socket is their software abstraction layer.
Transient connection:
Connection> data transmission> close connection
HTTP is stateless. the browser and server establish a connection every time they perform an HTTP operation, but the connection is interrupted when the task ends.
It can also be said that a short connection means that the connection is closed immediately after the socket connection is sent and the data is received.
Persistent connection:
Connection> data transmission> keep connection> data transmission>... -> Close the connection.
Persistent connection means that the connection is established regardless of whether the connection is used or not, but the security is poor.
HTTP persistent connection:
HTTP can also establish persistent connections by using connection: keep-alive. HTTP 1.1 performs persistent connections by default. The biggest difference between http1.1 and http1.0 is that it supports persistent connections (appearance
Similar to the specified keep-alive that can be displayed in the latest http1.0), but it is still stateless, or Untrusted.
References:
Bytes
Bytes
Bytes