Chapter 8. Client and Server Applications

In the previous chapter, we looked at exchanging data between devices by using the sockets interface. In this chapter, we're going to use sockets to build network applications. Sockets follow one of the main models of computer networking, that is, the client/server model. We'll look at this with a focus on structuring server applications. We'll cover the following topics:

  • Designing a simple protocol
  • Building an echo server and client
  • Building a chat server and client
  • Multithreaded and event-driven server architectures
  • The eventlet and asyncio libraries

The examples in this chapter are best run on Linux or a Unix operating system. The Windows sockets implementation has some idiosyncrasies, and these can create ...

Get Learning Python Network Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.