You ask how to replicate a specific solution (transferring a socket to a stream) to a wider problem (how to write scalable servers).
The "one thread per socket" design works in only one template, which is a request-response, for example. HTTP While really large volumes are used for data distribution (publication-subscription) or task distribution (pipeline). Model 1 to 1 does not fit.
This is a common mistake when you learn a new tool to ask, โHow does this tool do what my old tools do,โ but you wonโt get such good results. Instead, take the time to find out how this tool works, and then use this knowledge to rethink your problems and the best solutions for them.
source share