Original Post
I am trying to develop a chatserver with options to have it evolve into a MUD later. However, first previous attempt ended up in a terrible mess which was hard to maintain. Now that I am learning C# I want to give it another shot, and start out simple by just building a chat server with username/password login.
Taking the OOP path I came up with a few classes:
Server, ServerUI(Windows frontend), User and Protocol.
I think the classes speak for themself, however, I have no idea how I would handle the users. I listen for incoming connections inside the server class, and once a new connection is found, I create a new User object and pass the connection to the socket inside the class. But how do I handle incoming data and the state of the user?
Should I use an enum for it''s connection state? Connected, validated username, validated password, online. What other options are available?
And how should I have the user class handle it''s data? Verifying username/password can be done inside the User class itself, but sending messages or handling commands aren''t. How do I pass these back to the server? Delegates? And then have the server foreach over all the users and call User.Send()?
And then for commands, how do I handle those? In my previous MUD I use 1 class CCommand and stuffed all commands in there. It was a rather ugly and hard to maintain solution. What alternatives do I have here?
Toolmaker
My site /* -Earth is 98% full. Please delete anybody you can.*/
My site /* -Earth is 98% full. Please delete anybody you can.*/