TCP/IP, HTTP, socket, persistent connection, short connection

Source: Internet
Author: User

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.

SocketWhat is it?

SocketIs the application layer andTCP/IPThe intermediate software abstraction layer for protocol communication. A group of interfacesTCP/IPThe protocol family is hidden inSocketInterface.

So HTTP isTCP/IP application layer protocol.Socket is their software abstraction layer.

transient connection:
connection> data transmission> close connection
HTTP is stateless, each HTTP operation between the browser and the server establishes a connection, but the connection is interrupted when the task ends.
You can also say that a short connection means that the connection is closed immediately after the data is received after the socket connection is sent.
persistent connection:
connection> data transmission> keep connection> data transmission>... -> Close the connection.
persistent connection means that the connection is established after a socket 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. Use connection: keep-alive, and 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 it cannot be trusted.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.