The difference between a socket connection and an HTTP connection

Source: Internet
Author: User

HTTP is based on the socket. The socket is a complete set of interfaces for the TCP,UDP protocol.

HTTP protocol: Simple Object Access Protocol, corresponding to the application layer, the HTTP protocol is based on the TCP connection.

TCP protocol: Corresponds to the transport layer.

IP protocol: Corresponds to the network layer.

TCP/IP is the Transport layer protocol, which mainly solves how data is transmitted in the network, and the HTTP protocol is the application layer protocol, which mainly solves how to wrap the data.

Socket is the encapsulation of TCP/IP protocol, it is not a protocol, but a calling interface, through the socket, we can use the TCP/IP protocol.

HTTP connection: The so-called short connection, that is, the client sends a request to the server side, the server side of the response after the connection will be broken off.

Socket connection: The so-called long connection, in theory, the client and the server side once established connection will not be active disconnection, but due to various environmental factors may cause the connection to disconnect.

The difference between a socket connection and an HTTP connection

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.