30 December 2009

Prof. Xavier Chatting with Magneto
I just had my CSEN503 Project Evaluation today, we were required to make a Chat
Room Server and Client that uses TCP Socket Connections and we had to program
it in JAVA (the GUI was a bonus), we worked in teams of 2 or 3, I was late to
submit my team members list so I was put with a random student :S
So, since the evaluations are done, I can safely post the Project's Code without
any worries.
To use the app, someone first has to start the server class and enter a port
to use for listening to incoming connection requests, it must be an unused TCP
port (eg: don't use port 80 or 8080 as your web browser uses them).
Later a users can run the Chat class, the user will then see a connection dialog
box, he should enter the hostname or IP of the server they want to connect to
(or leave it empty if you want to connect to localhost) and enter the port opened
by that server.
Then a Room Manager dialog box will appear, here the user specifies an Alias
to use for chatting, and he can List the Chat Rooms on the server and Join a
Room or he can Create a new Room.
Then the Chat Window will appear, here the user can enter a message and send
and receive messages from all the members in the Chat Room, he can also see
a list of the members connected to the room (but the list has to be refreshed
manually).
The user can leave the room at any time to change his Alias and Join (or Create)
another room through the Room Manager.
If a user left a room and he was the last one in it, the room will be removed
from the server.
Closing the Chat Window will automatically remove you from the room and disconnect
you from the server.
You can test the application by running the server and as many chat clients
as you want, just take care to enter "localhost" as the host name (or leave
it empty) each time you open the chat client.
Below you'll find a link to a .zip file containing the source code in .java
files and the compiled .class files, you'll also find a "Run Server.bat" file
to run the server in a console window and a "Run Chat.lnk" file run the Chat
Client, and you'll find to files that you might use if you want to open the
project in the Eclipse IDE.
You need to have the Java Runtime Environment (JRE) to run the project, and
you must have the Java Development Kit (JDK) to be able to modify and re-compile
the project.
BTW checkout the screenshot on the right :)