Relationship between socket connection and TCP Connection

Source: Internet
Author: User

When transmitting data, we can only use the (Transport Layer) TCP/IP protocol. However, without the application layer, we cannot identify the data content. If we want to make the transmitted data meaningful, you must use the application layer protocol. There are many application layer protocols, such as HTTP, FTP, and telnet. You can also define the application layer protocol by yourself. The Web uses HTTP as the application layer protocol to encapsulate HTTP text information, and then uses TCP/IP as the transport layer protocol to send it to the network.

1) socket is an interface programmed for TCP and UDP. You can use it to establish TCP connections. TCP and UDP protocols belong to the transport layer.

HTTP is an application layer protocol, which is also based on the TCP protocol.

(HTTP is a car that provides a specific form of encapsulation or display data; socket is an engine that provides network communication capabilities .)

2) socket is the encapsulation of TCP/IP protocol. socket itself is not a protocol, but an interface (API) called. Through socket, we can use TCP/IP protocol. The emergence of socket only makes it easier for programmers to use the TCP/IP protocol stack. It is an abstraction of the TCP/IP protocol, thus forming some of the most basic function interfaces we know.

Ing between Socket API and TCP State _ three-way handshake (Listen, accept, connect) _ four-way handshake close and TCP Delay confirmation (call the setsockopt function once and set tcp_quickack) _ be careful with the "package seek" issue of persistent connection APIs


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.