There are two sections to this README: I. Features II. Instructions
=============================================================
NOTE: This program was for a class project, so it had certain requirements (see statements below for more details). I have the left the words/strings within the list empty so that the user could choose what to include or not include. For the program to work correctly, words will have to be entered in that section of the code.
I. Features
-
This program gives a message indicating a set format to compile and run the code at the command line (e.g., script IP port#). If the wrong format is entered, it gives a statement about what to enter for the correct format in order to connect with the server.
-
This program indicates when users have connected to the server.
-
When connected, on the server side, the IP address of each user shows up. This is important for system administrator since—if data is needed to be found or monitored in the chat room—the name of the user and the message also shows up each time a message is sent from client to client.
-
This program is capable of having multiple clients connect from different computers (different IPs). So, the sockets allows for multiple clients, instead of it being communication between the server and one client.
-
This program allows clients to choose their own chat room name. When clients have connected to the server, a greeting is displayed on the screen, and then they are asked to select a user name. The user name continues to remain on the screen as they send message back and forth from client to client.
-
There are two ways clients can leave the chat room. First, if they use a taboo word, and second if they decide to sign out by typing in a keyword to exit the program.
-
If a user enters a taboo word, a “disconnected” message shows up on his or her screen, and the connection is removed. No more typing or sending of messages can be completed. Additionally, when the specific client has been disconnected, a message also shows up to the server and other clients that the specific client who used the taboo word has been disconnected (note: the program shows the user name of the client disconnected also, not just IP or a message with no IP or user name).
-
If a client signs out of the chat room for any reason, a message appears on the server and other client sides stating which client has left the chat room.
=============================================================
II. Instructions
-
Download or upload the two Python programs to your computer (e.g., chatServerSide and chatClientSide). Save the programs somewhere to a path you can find on your computer (NOTE: If you want to change the badwords or taboo first before running the program, open the on client side and change the words. If not, compile the program, and default exit words are already in the program).
-
Open terminal, or some other command line GUI, to compile the program and to get it up and running.
-
With the command line GUI open, compile the server side first. In the terminal, cd to the directory or desktop where you saved the Python programs (i.e., get in the correct path on your computer where the programs are), and then type…
python chatServerSide.py <yourIPaddress> <port#> Note: If you are using python 3, you will want to type python 3, instead of just python.
-
A message should appear on the screen that the server is activated. If not it will tell you the correct format to type in the command to activate the server. After the connection, you have two options: You can either connect clients to the server on the same machine, or connect clients from other machines to the host machine.
a. Connecting clients on host machine: Create/open a new command line GUI and type the following command: python chatClientSide.py <yourIPaddress> <port#> b. Connecting clients on different machines to host machine: You will want to have the client program downloaded on the computer you are using and cd to where that program is saved in terminal to compile it. You will then follow the same procedure for 4(a) and type: python chatClientSide.py <yourIPaddress> <port#>
-
If you are on the host machine, you will see your own IP address appear on the server side and a greeting to the chat room on the client side. If not, you will not see the server side, but you get a greeting on the client side.
-
You will be asked to enter a user name, and this will remain throughout the chatting unless you either type “Quit” to exit the chat room or use a taboo word, in which case you will be disconnected from server.
Note: Only the sys admin could see both user name and IP address. This would helpful if for some reason the chatting needed to be monitored or permissions set.