Write a Thread-Safe Program

Question description

Write a thread-safe program that passes messages between a client and a server, modifying an existing program that I have already written.