Thread: Chat Client
View Single Post
  #1 (permalink)  
Old 05-28-2007, 06:58 AM
Jessi34 Jessi34 is offline
Member
 
Join Date: May 2007
Posts: 3
Jessi34 is on a distinguished road
Chat Client
I need to do this for my class
But I am confuse can someone help me out
The GUI to your chat client will look like the following:







The File menu will have Send(Ctrl-S) and Exit(Ctrl-E) menu items. The Edit menu will have a Cut(Ctrl-X), Copy(Ctrl-C), and Paste(Ctrl-V) menu items. The Help menu will have an About(F10) menu item. You will need to add mnemonics to each menu item, as shown in parentheses above. In other words, if the user types Ctrl-S, the text in the text field should be sent to the server, as if the OK button were clicked or the File->Send menu item were clicked.



Hopefully each of those menu items is self-explanatory, but one note is that a user will not be able to cut or paste from the large text field, but only copy. The About box from the Help menu will display a dialog box that shows information such as your name, the name of the application, the version, and of course, your instructor’s name.



The main class for your chat client will be named ChatClient and be in the chatclient.gui package.



For the networking portion of the project, your code will need to communicate with the ChatServer program we wrote in class. The ChatClient will begin by sending a message with a username to the ChatServer. The ChatServer will store the username with each socket connection so that each subsequent message that is sent from the ChatClient will be prepended with the username by the ChatServer before being sent to the other ChatClients. The ChatServer will prepend the username and “->”to the message.



You will also need to read a configuration file that will specify the user’s name, the server’s name, and the port on which the ChatServer is listening. If you would like to add more information into the configuration file, you can, but make sure it at least has these three parameters. Here is a sample configuration file:



# username

username=jeff



# server hostname

hostname=127.0.01



# server port

port=6789



Any line that is blank or starts with a # should be ignored. The rest of the lines will contain key=value pairs. You will read the name of the configuration parameter along the command line in your ChatClient code.



The username is the value that will be prepended to each line sent. The hostname and port give the location of the ChatServer. The ChatServer and ChatClient could be running on the same computer or separate computers.



Further, you need to have a different type of message to allow for private chats. In class, we only implemented broadcasting, meaning that whenever the ChatServer received a message, it sent that message to all users. You will need to allow another type of message to be transmitted that specifies the name of a user followed by the message to send to that user. In that case, only that user will receive the message, but not any other user.



Ensure that no exceptions can be thrown. Even for badly formatted configuration files, there should be no possibility of throwing an exception. Also, you may have helper classes if necessary.
Reply With Quote
Sponsored Links