Rutgers CS352 Example Chat Client Version 1.0.9 Last updated May 1, 2012 Git Repository: https://github.com/romoore/cs352-chat This application is free software according to the terms and conditions of the GNU General Purpose License, version 2.0 (or higher at your discretion). You should have received a copy of the GNU General Purpose License v2.0 along with this software as the file LICENSE. If not, you may download a copy from <http://www.gnu.org/licenses/gpl-2.0.txt>. Compiling the client: The chat client has been written according to Java 1.6. If you do not have Java 1.6 installed, please download and install the JDK from Oracle at <http://www.oracle.com/technetwork/java/index.html>. To compile the chat client, include the "src/main/java" directory in the class path and provide edu.rutgers.cs.chat.ChatClient as the main class to be compiled: javac -cp src/main/java/ src/main/java/edu/rutgers/cs/chat/ChatClient.java Running the client: The chat client requires 2 command-line parameters: local listen port and username. These are the first two parameters to the client. Optionally, multiple remote clients may be specified as bootstrap clients. Each pair of additional parameters are the remote host/IP address and port number. To start the client with "foo" as the username, listening on port 12345: java -cp src/main/java/ edu.rutgers.cs.chat.ChatClient 12345 foo To start the client with "foo" as the username, 12345 as the listen port, and 1.2.3.4:9999 as a bootstrap peer: java -cp src/main/java/ edu.rutgers.cs.chat.ChatClient 12345 foo 1.2.3.4 9999 To start the client with "foo" as the username, 12345 as the listen port, a GUI, and 1.2.3.4:9999 as a bootstrap peer: java -cp src/main/java/ edu.rutgers.cs.chat.ChatClient 12345 foo 1.2.3.4 \ 9999 --gui Interacting with the console-based user interface: The current version uses a console user interface by default. Once connected to a remote peer, the user may send messages to all connected clients by typing a CR/LF-terminated string to standard input. To send the message "Chatting is fun" to all currently-connected clients: Chatting is fun<CR/LF> It is possible to send a message to a specific peer (private chat) by starting the message with @username. To send the message "I like ponies" only to username "bar": @bar I like ponies<CR/LF> The user may exit the chat client by typing the word "quit" alone on a line: quit<CR/LF> Interacting with the graphical user interface (GUI): You can use the GUI by passing --gui as a command-line option at startup. The GUI has several components: the User List shows all connected users, the Chat Log shows the chat history, You Message is a buffer where you can input your next message. To send your message to all users, type it into the Your Message buffer, and click "Send" or press "Enter". If you wish to input a newline character in your buffer, use Shift+Enter. If you want to send a private message to another user, select their name in the User List and then click Send or press Enter after typing your message in the buffer. You must reselect a user name to send another private message. Start-up scripts: Two start-up scripts have been provided for ease in setting-up a consistent server to run and for clients to connect to. They are provided in the "scripts" directory, "server.sh" and "client.sh". server.sh - By default listens on port 8765, which can be overridden with the "-p PORT" option. client.sh - By default connects to another client (server) at localhost:8765. The host can be set with "-h HOSTNAME", and the port with "-p PORT". "-g" will cause the client to launch with the GUI instead of the console UI. The only required parameter is the chat client username, provided as the last command-line parameter.