CS151 Object Oriented Programming
Homework 3
Using the client/server computing concepts taught in class to write a Java chat
application.
The Java application has to fullfill the following:
- The Java application could either run as a client or server.
- The name of the application is called cuteChat.
- When running as a server, it takes the key word "SERVER", TCP/IP hostname and
port as the input parameters.
(Start the application by:
java cuteChat SERVER serverhostname 8888)
- After the server is started, a Java swing UI is presented and ask the user to enter the
following information:
- First Name (Example: Mary)
- Last Name (Example: Jones)
- Nickname (Example: cutegirl)
- Age (Example: 23)
- Description (Example: Want to make friends)
- After the information is entered, the server waits for a client to connect in a chat
session. The nickname is used as the prompt
(Example: cutegirl > ......)
- When a client is connected, the First Name, Last Name, Nickname, Age and Description
will be sent to display in the client. (For example, the client could receive "Mary
Jones nickname cutegirl, 23 years old who want to make friends accepted your call.")
- When running as a client, it takes the key word "CLIENT", TCP/IP hostname and
port as the input parameters.
(Start the application by:
java cuteChat CLIENT serverhostname 8888)
- After the client is started, a Java swing UI is presented and ask the user to enter the
following information:
- First Name (Example: John)
- Last Name (Example: Park)
- Nickname (Example: handsomeguy)
- Age (Example: 25)
- Description (Example: So cool)
- After the information is entered, the client connects to the server for a chat session.
When a client is connected, the First Name, Last Name, Nickname, Age and Description will
be sent to the server for display. (For example, the server could receive "John Park
nickname handsomeguy, 25 years of age who is so cool connected to you.")
- The nickname is then used as the prompt
(Example: handsomeguy > ......)
- When both the client and server are connected to each other, they can start chating:
cutegirl > John Park nickname handsomeguy, 25 years of age who is so
cool connected to you.
handsomeguy > Mary Jones nickname cutegirl, 23 years old who want to
make friends accepted your call.
cutegirl > How are you today
handsomeguy > I am fine
cutegirl > What are you doing in the weekend
cutegirl > Tell me
handsomeguy > blah, blah, blah
- Please make sure the UI looks good
Extra Credit
Modify your chat server to be a multi-thread server which can handle multiple clients
to have a conference session. The server in that case tracks all the clients login and
boardcase all the chat text to all the clients.
NOTE: What to handin:
- Use a good word processor to writeup all the written assignments. Print them out and
handin in class.
- Handin DETAIL running instructions and the actual program (source + class files + html
file, etc). Print instruction and program listing out, and hand them in with the computer
diskette.
- No late assignment will be accepted
- DO NOT EMAIL ANY assignment to me. Handin in class
- Points will be taken off if you violate any of the above.