In this project you are going to learn about two new topics, using pipes for interprocess communication and using multiplexed I/O to construct a single-threaded server application.
Unlike previous projects, I will not be providing you with code samples or lecture notes to use as a starting point. Your first job will be to do some reading in the textbook and some research online to get a basic understanding of these concepts.
In this project you are going to implement a chat application. I will provide you with a chat client application and you will construct two server applications. The main server application will allow users to send in comments for the chat, and will distribute those comments to all the connected clients. A secondary server application will collect the most recent comments sent to the main server in a transcript. Clients can connect to the secondary server to download a list of the most recent comments in the chat.
Here is how the system will work:
Click the button at the top of the page to download an archive containing a NetBeans project for the client application. You will run the NetBeans application on your laptop, and it will connect to the server applications running in your container. The Java application assumes that the primary server is listening on port 8000 of localhost and the secondary server is listening on port 8001.
Since we need to run two server applications you will need to rebuild your container to expose two ports instead of just one. Run this command in a terminal to set up your new container:
docker run --name Chat -p 8000:8000 -p 8001:8001 -v "$(pwd)":/home/480 -it ubuntu /bin/bash
Remember that this command will map your current working directory to /home/480
in the container, so please be careful to cd to the correct directory before running this command.
Once you have set up the new Chat container, start it up and open a command prompt to it and run
apt update apt upgrade apt install build-essential gdb
Next, read the section on multiplexed I/O in chapter two of the textbook. You should also take a look at this example of a single-threaded server that uses multiplexed I/O to watch for input from multiple clients.
The textbook does not provide coverage of named pipes, so you will have to fall back on online resources. Here are a couple of reasonably good online tutorials on pipes and named pipes.