Thread: problems in with design of a server project.

  1. #1
    sockets mad
    Join Date
    Mar 2002
    Posts
    126

    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,

    Daniel.

    (Apologies for the title not making much English sense )
    Last edited by codec; 02-21-2003 at 07:47 PM.

  2. #2
    Registered User
    Join Date
    Aug 2002
    Location
    Hermosa Beach, CA
    Posts
    446
    Have you looked at ACE? It is a cross-platform network library in c++ (since you mentioned it). It is free to download, and there is a really good book that goes for about $40 that explains its design and how to use it. Also his running example in the book is a network logging server, which might give you enough example code to run with. Can't think of the exact name of the book, but I have it at home if you really are interested in the title.
    The crows maintain that a single crow could destroy the heavens. Doubtless this is so. But it proves nothing against the heavens, for the heavens signify simply: the impossibility of crows.

  3. #3
    sockets mad
    Join Date
    Mar 2002
    Posts
    126
    Sorry for the late reply I've been away for a few days.

    Thanks for the advice on network libraries but that's a bit far off yet. But thanks all the same. I'm more concerned about the other questions i posted if anyone can help me out at all. I've got this far by myself without a single lesson in C++ but I'm in need of a bit of help now

    Thanks,

    Daniel

  4. #4
    Registered User
    Join Date
    Jan 2003
    Posts
    78
    You should probably take a look at Jeffrey Richter's book "Programming Server Side Applications". It's all Win32, but I think he covers exactly what you want to know about.

  5. #5
    sockets mad
    Join Date
    Mar 2002
    Posts
    126
    Thanks for the great response people, it was exactly what I was looking for and I'll deffinately look into the book you mentioned.

    I didn't realise it would probably be as simple as enclosing the WSA functions in preprocessor conditions for it to be mostly portable network wise.

    Thanks again, you've given me some great leads to read-up on.

    Daniel

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Server Architecture
    By coder8137 in forum Networking/Device Communication
    Replies: 2
    Last Post: 01-29-2008, 11:21 PM
  2. Game Independent Anti-cheat Project Needs Programmers
    By GIA Project Lea in forum Projects and Job Recruitment
    Replies: 3
    Last Post: 09-15-2005, 07:41 PM
  3. errm, problems with da server...
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 03-17-2003, 04:19 PM
  4. IE 6 status bar
    By DavidP in forum Tech Board
    Replies: 15
    Last Post: 10-23-2002, 05:31 PM