Differences between TCP/IP, UDP, Http, and Socket
From top to bottom: presentation layer and application layer: HTTP protocol (based on the transport layer of TCP protocol, mainly to solve how to package data)
Session Layer
Transmission Layer: TCP protocol (Network-layer IP protocol) and TPC/IP protocol (mainly to solve how data is transmitted in the Network)
Network Layer: IP protocol
Data Link Layer
Physical Layer 4. socket is the encapsulation and Application of TCP/IP protocol (programmer level). Socket itself is not a protocol, but an interface called (API, it only provides an interface for TCP or UDP programming). Through Socket, we can use the TCP/IP protocol. In fact, the Socket and TCP/IP protocol are not necessarily related.
The Socket programming interface is designed to adapt to other network protocols. Therefore, the appearance of Socket only makes it easier for programmers to use the TCP/IP protocol stack. It is an abstraction of the TCP/IP protocol, this forms some of the most basic function interfaces we know, such as create, listen, connect, accept, send, read, and write.
6. the relationship between TCP/IP and HTTP is easy to understand in the Network: "When we transmit data, we can only use the (Transport Layer) TCP/IP protocol, however, without the application layer, the data content cannot be identified. To make the transmitted data meaningful, you must use the application layer protocol. There are many application layer protocols, for example, HTTP, FTP, and TELNET, you can also customize the application layer protocol. 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 ."
10. the network has a saying that the relationship between socket and TCP/IP protocol is easier to understand: "TCP/IP is just a protocol stack, just like the operating mechanism of the operating system, it must be implemented in detail, it also provides external operation interfaces. Just as the operating system provides standard programming interfaces, such as win32 programming interfaces, TCP/IP also provides interfaces that programmers can use for network development. This is the Socket programming interface."
11. CSDN has a more vivid description: HTTP is a car that provides a specific form of encapsulation or display data. Socket is an engine and provides network communication capabilities.