Thread: Multi-client/Server design

  1. #1
    Registered User
    Join Date
    Oct 2009
    Posts
    17

    Multi-client/Server design

    Hi everyone, i developing a kind of "limited chat room" whereas my machine is the server and in my network pair of clients join to chat. kind of stupid.... But what I want to know is your opinion on how to design the server.
    I think that creating a thread for each client is bad practice but on the other side I think that's the best way of making it work. Instead I can create a thread for each room and use select to unblock the server from I/O with the clients.

    waitting for your opinion...

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    A multi-threaded server approach is very common, and is usually easier to implement than a non-blocking server. Obviously, if you plan on having thousands of clients connecting at a time, then spawning a new thread for each one is not a good idea.
    bit∙hub [bit-huhb] n. A source and destination for information.

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    How about polling and non-blocking sockets?


    Quzah.
    Hope is the first step on the road to disappointment.

  4. #4
    Registered User
    Join Date
    Oct 2009
    Posts
    17
    Quote Originally Posted by quzah View Post
    How about polling and non-blocking sockets?


    Quzah.

    yep, I have read something about that, can you give me some links about polling

    thanks

  5. #5
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Design for Multi Version of a File.
    By bean66 in forum C++ Programming
    Replies: 2
    Last Post: 03-31-2009, 01:46 PM
  2. which design is better to wrap another class instance
    By George2 in forum C++ Programming
    Replies: 7
    Last Post: 04-13-2008, 12:27 AM
  3. Implementing Inheritence into your design
    By bobthebullet990 in forum C++ Programming
    Replies: 6
    Last Post: 08-05-2006, 04:40 PM
  4. Client/Server program design
    By Coeus in forum C++ Programming
    Replies: 4
    Last Post: 01-05-2002, 01:07 AM