实际上,我正在学习计算机网络,与此同时,我对Web服务器如何维护多个连接感到困惑。
简而言之,我了解到谷歌搜索是套接字处理每个客户端请求。
因此,假设有一个Web服务器,并假设有2个具有IP的客户端
Client A: 5.5.5.5
Client B: 10.10.10.10
他们都尝试通过端口80连接到服务器。
现在,通过搜索我得到的是什么,服务器在端口80侦听传入的请求。然后,假设客户端A尝试连接到服务器(进行TCP / IP连接)。在这两者之间创建套接字。然后将其作为单独的线程执行以进行进一步的通信,从而使服务器再次侦听该特定端口上的其他客户端请求。而客户B连接方式相同。
现在我的第一个问题是:
1. How does server communicate with these two clients simultaneously
after the connection has been established?
现在,实际上,不仅有2个客户端,而且成千上万的用户可以连接到服务器。
然后我的下一个问题是:
2. Now, how do those thousands of clients get connected to a single server?
If we assume every client is connected to the server through wire, it is not
practically possible to maintain that many sockets on a hardware for
connection. How those thousands connections are made and handled?
最后,我的第三个问题是:
3. Above I said (actually heard) how **client A** connected to the the server
and similarly the client B.
But I didn't get the part stating "after a TCP/IP connection is made they
continue separately in a separate socket and making server to listen for
other client requests." What does that mean? If one client is communicating
to the server, how come other can communicate at the same time to same server.
Isn't it like while a student is asking question to a teacher, other can't
ask at the same time since that particular student is busy or occupying the
teacher at the moment so others should wait, which we compare than client B
should wait when client A is communicating.
这些是我没有得到的基本问题。如果我弄错了,请纠正我。您可以建议我阅读一些书籍/ pdf,如果答案很详细或不是专门针对特定部分。谢谢