9.5. Programming Assignment 5 – Add BRB feature to Multi-threaded Chat Server¶
In the previous section (A Multi-threaded Chat Server), we review the strategies for writing asynchronous and threaded servers. In particular, we apply those strategies toward developing a multi-threaded chat server.
I am providing to you a working chat server and client program complete with a graphical user interface. The client program uses wxPython [wxPython] to implement the graphics, which was also used in the web programming project. You should not need to modify the client program at all. See below for links to download the source code and to view videos demonstrating use of client and server programs as supplied and after the additional features are added.
The application layer protocol used by the chat application is similar to IRC.
For example, the user of the client program might send
to change the name attributed to their messages. Also messages
/quit parting message may be used to announce their departure and
close the connection. The functions
string.strip() from the
string module are used to help with the
needed string processing.
You are to modify the chat server to implement a be right back (BRB) feature.
You will notice a Be Right Back button in the graphical client
application. When that button is clicked on, a message is sent to the server
of the form:
/brb message, where message is text taken from the user
input window, if any is available. After the BRB button is clicked on, the
text of button changes to I’m Back. Similarly, when the button is
clicked on a second time, a message of
/back message is sent to the
The behavior of the server should be to announce when the user is away and back again to all the users. While the user is away from the chat session, no messages should be sent to the user. After they are back, any messages still in the queue, which have not previously been sent to the user should be sent at that time.
You can find example code to model your code after in the existing handling of
This is actually a fairly short programming assignment in terms of how much code you need to add to the program. The main goal is that in going through the program, you gain an understanding of how sever programs work. To supplement the programming assignment and to facilitate your comprehension of the program, you will also find below some reflective questions to answer and submit as the second part of homework covering server programming.
9.5.1. Files to Download¶
The first three files below are all needed for the client part of the chat application.
9.5.2. Demonstration Videos¶
The 2008 Server Demo is interesting because is shows interacting with the server without using the client and shows the native IRC protocol commands typed and sent to the server.
Note, the following three videos were done with the intent of duel posting to K–State Online and ShowMeDo, which is why in a places, I may sound like I’m not addressing the class. These videos are available in the ShowMeDo Python Network Programming Series.