To handle multiple connections, you’ll use the selectors
module. However, you could opt to use threads. If you’d like to dive into this alternative implementation, then check out the following resources:
- 📰
asyncio
— Asynchronous I/O - 📰 Async IO in Python: A Complete Walkthrough
- 🎬 Hands-On Python 3 Concurrency With the
asyncio
Module - 📰 An Intro to Threading in Python
- 🎬 Threading in Python
While threading is certainly worth learning, it can get a bit complicated. The selectors
module helps to simplify how you handle concurrency.