Handling Multiple Clients
select and poll.
The Concurrency Problem
A simple server handles one client at a time. If a client is slow, everyone else waits. To serve many clients concurrently, you need a different model.
Approaches to Concurrency
Three common strategies:
- Thread/process per client: simple but heavy at scale
- I/O multiplexing with
selectorpoll: one thread watches many sockets - Event loops with
epoll/kqueue: scales to thousands
All lessons in this course
- Sockets Overview
- TCP Server
- TCP Client
- Handling Multiple Clients