Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我知道多线程非常适合这种情况,但是是否有任何实例可以说明这种情况?
是的,您可以从一个线程同时为多个客户端提供服务。这通常使用 select() 或 poll() 套接字函数来实现。
与多线程服务器相比,基于单线程 select() 的轮询服务器可以使用更少的系统资源。