动态端口不是一直在变化吗?如果是,这些端口是否会改变并且通信停止?请指教。
2 回答
如果我理解你的问题,那么简而言之,不。
当您的 HTTP 客户端(又名 Web 浏览器)打开连接时,操作系统会从动态(或“临时”)范围中选择一个随机端口号。
该连接的所有通信继续使用同一端口。
只有在打开新连接时才会选择另一个端口。
To clarify the other end...
Servers of "standard application protocols", like HTTP and FTP have a port assigned to them by a standards body IANA. For example, in the case of HTTP, the default port is "80".
Unless the client selects a non-standard port, web connections are always made to port 80.
The web server is always listening on port 80, it never goes anywhere.
Separately, some protocols use "dynamic protocol assignment", where the protocol number of a service can change, but there is a way to make sure the changing port number is known.