套接字

作者: 凡择 | 来源:发表于2018-03-22 08:39 被阅读0次

    非常经典的说明,可以经常看 socket与port

    A TCP socket is an endpoint instance defined by an IP address and a port in the context of either a particular TCP connection or the listening state.

    个人理解:

    1. 说套接字是需要上下文的。只有针对一个具体的tcp连接(不仅仅有自身的ip和端口,还有对方的ip和端口)或者监听状态(对于一个ip+port,只能由一个监听者。写程序时有时报错说端口已经被使用就是因为一个端口只能由一个监听者)时才有意义。套接字不是一个独立的概念,是必须在上述两种场景下才有意义的。

    A port is a virtualisation identifier defining a service endpoint (as distinct from a service instance endpoint aka session identifier).

    A TCP socket is not a connection, it is the endpoint of a specific connection.

    There can be concurrent connections to a service endpoint, because a connection is identified by both its local and remote endpoints, allowing traffic to be routed to a specific service instance.

    There can only be one listener socket for a given address/port combination.

    相关文章

      网友评论

          本文标题:套接字

          本文链接:https://www.haomeiwen.com/subject/pcpoqftx.html