Any difference between socket connection and tcp connection?

后端 未结 4 1725
南方客
南方客 2021-01-31 10:59

Are these 2 concepts refer to the same thing? Do they have difference?

In my opinion, they are different, and socket connection is based on tcp connection. A socket cont

4条回答
  •  忘了有多久
    2021-01-31 11:38

    TCP/IP is a protocol stack for communication, a socket is an endpoint in a (bidirectional) communication. A socket need not be TCP based, but it is quite often the case. The term socket is also often used to refer to the API provided by the operating system that allows you to make a connection over the TCP/IP stack, for example, the Winsock API provides an API for connections over the TCP/IP stack on Windows.

    A socket is mapped uniquely to an application as the ports are managed for you by the operating system.

    Further reading: http://en.wikipedia.org/wiki/Internet_socket and http://en.wikipedia.org/wiki/Winsock

提交回复
热议问题