Socket network communication
What is Socket?
Socket is actually a socket. Most people’s understanding of Socket is that it can realize a simple network communication, but it “specifically solves what problems? What practical role does it have? Why does a Socket appear?”
Socket is actually a product between the application layer and the transport layer. It encapsulates many complex operations of the transport layer into some simple interfaces, which are called by the application layer to realize the communication between processes in the network. Socket is a For port communication development tools, it needs to be more low-level.
A complete network communication must go through the network cable and network card of the physical transport layer. The IP protocol of the network transport layer can know which machine to send the data to, but different processes will run in the computer system. “The network data in the network card is identified for which process” , this is actually the point that the Socket design wants to solve.
Socket is “encapsulation of TCP/IP or UDP/IP protocol” , and Socket itself is actually a calling interface. Through this interface, when we develop network applications, we don’t need to care about how the bottom layer is implemented, which reduces the difficulty of development.
Socket running process
TCP based
Server
- socket(): Indicates that a socket is created, and the bottom layer will generate a file descriptor to indicate the
…
The post Socket Network Communication first appeared on Lenix Blog .
This article is reprinted from https://blog.p2hp.com/archives/9116
This site is for inclusion only, and the copyright belongs to the original author.