An assignment to explore sockets and multithreading. MAKE SURE TO COMMIT AND PUSH AS YOU GO. YOU SHOULD BE MAKING MULTIPLE COMMITS PER WAVE.
DO NOT USE AI FOR THIS PROJECT
- Take a moment to read through the ChatterboxClient.java file. Note what is currently implemented, and what you will be expected to implement.
- Try running ChatterboxServer using the example command in ChatterboxServer.java. You do not need to understand everything in this file, but you will be using the server to validate that your client is working! If working, it will talk about setting up, then every 10 seconds show a heartbeat message. It will take about 10 seconds for the first heartbeat to show up.
- Try running ChatterboxClient using the command in the file. It will tell you that argument parsing is not yet implemented (because you haven't written it yet!) This is expected. You will be resolving this in the next wave.
- Implement
parseArgsaccording to the instructions. - Validate your solution by re-running the client. It should print out the arguments it parsed, then an error about the constructor. Make sure everything is parsed correctly! You will handle the constructor in the next wave.
- Make sure you've committed and pushed!
- Implement the ChatterboxClient constructor. You will note it is already partially created for you.
- Validate your solution by re-running the client. It should now give you an error about connect()
- Make sure you've committed and pushed!
- Implement the connect method. This will consist of making a socket on the correct port and using its streams to make buffered readers/writers.
- Hint: for the purposes of this assignment don't worry about the warnings of not closing resources. There are ways to nicely handle this, but it's also very easy to accidentally close things you don't want to. Come by office hours if you want to talk about the right way to handle this.
- MAKE SURE THE SERVER IS RUNNING.
- Validate your solution by re-running the client. Make sure to use localhost and the same port the server is on. It should now give you an error about authenticating.
- BE CAREFUL TO MAKE SURE YOU'RE DOING THIS PROPERLY! Make sure to set up this.serverReader and this.serverWriter in connect()!
- Make sure you've committed and pushed!
- Implement the authenticate method. Your client will need to send the username and password, separated by a space and ended with a newline.
- MAKE SURE THE SERVER IS RUNNING.
- Validate your solution by re-running the client. Make sure to use localhost and the same port the server is on. If working, you should see a welcome message in the client and the server notify when the client disconnects. The client should then give an error about chat streaming.
- Make sure you've committed and pushed!
- Implement
printIncomingChatsand call it instreamChat. Do not yet worry about threading or outgoing chats. YOU DO NOT NEED TO MAKE ANY NEW THREADS FOR THIS WAVE. - MAKE SURE THE SERVER IS RUNNING.
- Validate your solution by re-running the client. Make sure to use localhost and the same port the server is on.
- You should see a repeated heartbeat message from the server when it is working. The heartbeats should come every 10 seconds or so
- Make sure you've committed and pushed!
- Implement
sendOutgoingChats. ModifystreamChatso that it properly multithreads between printing incoming and sending outgoing. - MAKE SURE THE SERVER IS RUNNING.
- Validate your solution by re-running the client. Make sure to use localhost and the same port the server is on. You should be able to type in the client and see your message echoed back to you after hitting enter.
- Try connecting multiple clients! You'll need to use different usernames/passwords from sample_users.txt
- Make sure you've committed and pushed!
- Soon you will be emailed an IP address, port, and a set of usernames and passwords to use for connecting to our live class server. DO NOT SHARE THESE ADDRESSES/PORTS/PASSWORDS WITH ANYONE AND DO NOT COMMIT THEM TO YOUR REPOSITORY. You can place them in my_passwords.txt for easy access. That file is in the .gitignore, so it should not get committed
- Attempt connecting your client! Make sure to use the actual IP address, NOT localhost.
- The server should have the same basic behavior, try chatting with your classmates and making sure everything works! I may put a few extra anti-spam measures on the server. DO NOT ATTACK THE MAIN CLASS SERVER. DO NOT SPAM IT. I will provide a separate server for you to try to attack.
- You will be emailed a separate server and set of usernames / passwords that you are allowed to attack. If you are able to take it down, you will receive extra credit. You are allowed to use AI to help you with your attack, but ONLY AFTER YOU HAVE ALREADY MADE A PR for your project. Do any attack commits for a malicious client in a separate branch.