I have the following homework assignment that i need to complete
Instructions: Write a program in Java that uses sockets to act as a chat server.
Use the String args parameter of the main method to allow command-line entry of the listening socket. By default, the socket should be 23, but if a command-line argument is passed, open a socket on the appropriate port.
Your chat program should require a signon before entering the chat room. The signon should be a simple string, without any authentication (duplicate names are allowed).
When a user enters the chat room, a message should be sent to all existing users.
While in the chat room, anything typed (other than exit or quit) should be sent to all chat room users, except for the sender, along with a prefix of who sent the message. For example, if user “bif” types “hello”, all users except bif should then see “bif: hello”.
A command of “exit” or “quit” will cause the user to exit the chat room and be disconnected. A message should be sent to all other users in the chat room.
You can work in pairs on this project. You may help other students with hints on where to look in the book or the Internet to find information on socket programming, but all code should be the work of yourself or the pair you are working in.
You can test your program using telnet clients (available in Mac, Windows, and Linux OSs as standard utilities)
I have done a lot of research and basically know how to create sockets, servers, and clients. Im just not sure where to start or how to organize it. I know nothing about telnet. i need a really good tutorial or a basic diagram on how to implement the code such as: create a socket, connect using a server, type in words. I'm just not sure of the diagram i need to follow or what classes i need. any help would be greatly appreciated.
As you know the basics of sockets, you can start with very basic client-server application and follow step-by-step development:
1) Create 1 server and two clients. See if those clients can communicate with each other.
2) Modify the server to accept more client connection requests during runtime (you'll need to create a listener thread for this).
3) See if multiple clients can communicate with each other.
Once these things work out, you may modify the code to notify all clients when a new client is registered etc.
For a very good treatment to such issues, I would highly recommend Java Network Programming by Harold.