problems with design of a server project.
I'm quite competent in C++ and the use of sockets and I've always wanted to code a simple p2p app that uses a central server (console app) to co-ordinate the p2p and a simple client, but I've hit a few difficulties when planning out how is the best way to code certain parts of the server since I don't have much experience in this area, as all my previous socket apps utilised simple one-to-one communication.
The two main problems I have are:
1) What is the best way to store data about the current users logged into the system within the app itself (e.g username, ip, description, etc) for it to be fast, use as little resources possible and be easy to code with? I thought about using classes or a link to and external sql database (libmysql) or something? I really am in the dark as to the best way to do this.
2) When thinking about the threading model I am going to use it seems starting a new thread for each client connection when there could potentially be 500+ connections would create too much overhead handling all the threads(?) I really don't know enough about threading to answer the question of what would be the best threading model to use.
As always, learning the concepts, functions and code is the easy part. It's the design and structure of code which is the challenge.
Any help would be greatly appreciated. If I've left out any information you'd like to know so that you can give me advice please feel free to ask.
btw: I'm developing this primarily on win32 but as a console app and hopefully using a cross platform network abstraction library so eventually I can use this as a project to learn how to port apps to *nix derivitives (this is a long way yet though :), one step at a time)
I guess this is less about actual code and more about program design.
Thanks in advance,
(Apologies for the title not making much English sense :) )