Skip to content

Update p02_creating_tcp_server.rst #336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/c11/p02_creating_tcp_server.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
serv.serve_forever()

使用fork或线程服务器有个潜在问题就是它们会为每个客户端连接创建一个新的进程或线程。
由于客户端连接数是没有限制的,因此一个恶意的黑客可以同时发送大量的连接让你的服务器奔溃
由于客户端连接数是没有限制的,因此一个恶意的黑客可以同时发送大量的连接让你的服务器崩溃

如果你担心这个问题,你可以创建一个预先分配大小的工作线程池或进程池。
你先创建一个普通的非线程服务器,然后在一个线程池中使用 ``serve_forever()`` 方法来启动它们。
Expand Down