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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.