Rob Prime wrote:The server has to inform the clients on who has sent the message. You can do that by either sending the user name from the client with the message, or by recognizing the user from the specific ClientHandler. I'd say the first solution is the easiest, and it keeps user names local to one place.
As for security, you could add both a welcome message and a departure message. A client first sends the welcome message when connected, and the server rejects the socket if the welcome message does not match. If a client disconnects it can send a departure message that allows your server to nicely clean up its resources (and inform other users that the user has left).
how would you do that? i am a beginning programmer and got the server code from a friend and i dont know where he got it. the client part i made via the server info but i still can not figure out how to get the username [art and how to add more security.
Duct tape is like the Force. It has a dark side, a light side, and it binds the whole universe together.