gpt4 book ai didi

tcp - TCP 是否使用另一个端口发送数据?

转载 作者:可可西里 更新时间:2023-11-01 02:31:30 33 4
gpt4 key购买 nike

听说对于TCP连接,服务器会监听一个端口,并使用另一个端口发送数据。

例如,Web 服务器监听端口 80。每当客户端连接到它时,该服务器将使用另一个端口(比如 9999)向客户端发送数据(Web 内容)。如果多个客户端连接到它,这个服务器是否创建多个“另一个端口”来发送回数据?

客户端是否像服务器一样使用2个端口(监听端口和发送数据端口)?

我说的对吗?我听很多人这么说,但我找不到任何关于这方面的好书或文章

请解释

最佳答案

I heard that for TCP connection, server will listen on 1 port, and use another port for sending data.

没有。同一个端口用于监听和接受连接,同一个连接通常用于发送和接收。 TCP 连接是双向的。 FTP 是一个异常(exception),因为它使用两个连接:一个用于命令,一个用于数据。

For example, web server listen on port 80. Whenever client connects to it, this server will use another port (say 9999) to send data (web content) to client.

没有。

If multiple clients connect to it, does this server create multiple "another ports" to send data back ?

没有。

And does the client uses 2 ports (listening port and sending-data port) as the server does ?

没有。

Am I right?

没有。

I heard many people said that

他们都错了。

and I can't find any good books or articles about this

没有。只有非常糟糕的书或文章才会说这样的话。

关于tcp - TCP 是否使用另一个端口发送数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15761776/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com