Building a chat application

Next, let's build a multi-client chat room. The goal of this program is to explore socket programming in further detail. This section also implements and discusses the client-server architecture that is so common in all network programs.

Our chat program will consist of a chat server, which listens for and receives all incoming messages on a given port.

It also maintains a list of chat clients that connect to the server. It then broadcasts any incoming messages to all connected clients:

Let's start with the code for the chat server.

A server runs on a remote host and has a socket bound to a specific port number. ...

Get Tkinter GUI Application Development Blueprints - Second Edition 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.