C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 10-22-2009, 04:21 PM   #1
Registered User
 
Join Date: Oct 2009
Posts: 15
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...
tmcp is offline   Reply With Quote
Old 10-22-2009, 04:27 PM   #2
Registered User
 
Join Date: Sep 2004
Location: California
Posts: 3,020
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.
bithub is offline   Reply With Quote
Old 10-22-2009, 04:32 PM   #3
+++ OK NO CARRIER
 
quzah's Avatar
 
Join Date: Oct 2001
Posts: 10,639
How about polling and non-blocking sockets?


Quzah.
__________________
Hundreds of thousands of dipshits can't be wrong.


Are you up for the suck?
quzah is offline   Reply With Quote
Old 10-22-2009, 04:36 PM   #4
Registered User
 
Join Date: Oct 2009
Posts: 15
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
tmcp is offline   Reply With Quote
Old 10-22-2009, 04:46 PM   #5
+++ OK NO CARRIER
 
quzah's Avatar
 
Join Date: Oct 2001
Posts: 10,639
Beej: Beej's Guide to Network Programming


Quzah.
__________________
Hundreds of thousands of dipshits can't be wrong.


Are you up for the suck?
quzah is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

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


All times are GMT -6. The time now is 01:19 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22