且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

socket连接和tcp连接有什么区别吗?

更新时间:2023-11-09 11:25:16

TCP/IP 是用于通信的协议栈,套接字是(双向)通信中的端点.套接字不一定是基于 TCP 的,但它经常是这样的.术语套接字也经常用来指操作系统提供的 API,它允许您通过 TCP/IP 堆栈建立连接,例如,Winsock API 提供了一个 API,用于在 Windows 上通过 TCP/IP 堆栈进行连接.

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.

进一步阅读:http://en.wikipedia.org/wiki/Internet_sockethttp://en.wikipedia.org/wiki/Winsock