Approaches to serve multiple clients
Approaches to serve multiple clients
- Subject: Approaches to serve multiple clients
- From: Igor Garnov <email@hidden>
- Date: Sun, 19 Dec 2004 00:02:27 +0300
Hello,
I am going to write a daemon, which is supposed to serve many clients.
They will connect and probably stay connected for a long time (several
hours). They will exchange data between themselves.
I am thinking about ways to implement this.
As I understand, there are two main approaches to organize the workflow:
1) I can fork with each connecting client, and serve each client by a
separate process. Of course, this is easy from the network programmer's
point of view, but taking into account the problem of transferring data
from a client to a client, this also has some disadvantages. Moreover,
this frightens me a little, because if there are, say, 1000 clients,
there also are 1000 processes. This is no problem for Apache, because
the lifetime of each its process is very short, but what about my
situation? Is it OK to have 1000 processes at the same time? What if
there are 2000? 3000?
2) I can use 'select' and have all clients served in the same process.
But as far as I know, there is a limit on the number of sockets that
'select' can watch upon.
Having written this, I personally think that I should fork a process
for each 100 clients, and use 'select' in this process to catch network
events.
I would be really grateful for any ideas on the problem.
Regards,
Igor
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden