Http and Socket differences

Source: Internet
Author: User

HTTP: Hypertext Transfer Protocol, first it is a protocol, and is based on the TCP/IP protocol on the basis of the application layer protocol. TCP/IP protocol is the Transport Layer protocol, which mainly solves how data is transmitted in the network, and HTTP is the application layer protocol, which mainly solves how to wrap the data. The HTTP protocol details the rules for communication between the browser and the server, and is the basis for the World Wide Web exchange of information. HTTP is based on the request-response form and is a short connection, and is a stateless protocol. For its stateless characteristics, in the actual application needs to have the form of the state, so generally through the Session/cookie technology to solve this problem.

Socket:socket is not a protocol category, but a calling interface (API), socket is the encapsulation of the TCP/IP protocol, by calling the socket, the TCP/IP protocol can be used. The socket connection is a long connection, in theory the client and server side will not actively disconnect this connection once the connection is established. The socket connection is a request-response form, and the server can proactively push messages to the client.

Http and Socket differences

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.