The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

simple Java chatroom

Quite simple I want to create a chatroom that accepts multiple clients all of which can assign their own ID. Whenever they input anything it is sent to all users. Currently I have a echo client server where the client inputs something and it is echoed back. My first question is how do I allow a user to give himself a username? obviously I need a variable somewhere that accepts the name what class do you recommend I put this in? and how would I get the name itself Something like if (theInput.equalsIgnoreCase("username" : ""))

Then all that I need to do is echo what the client says to all clients. I'm at a loss of how to do this so any advice would be much appreciated. Although I've found some tutorials and example code online I don't understand it and I don't feel comfortable using it if I don't understand even if it does work. Thanks