[Home] [Groups] - Message: [Prev in Group] [Next in Group]

nu.kanga.list.mud-dev

19551: RE: [MUD-Dev] Multithreaded servers using objects

[Full Header] [Plain Text]
From: "David Loeser" <daklozar@home.com>
Newsgroups: nu.kanga.list.mud-dev
Date: Mon, 14 May 2001 22:22:55 -0400
References: [1]
Organization: Kanga.Nu
> -----Original Message-----
> From: mud-dev-admin@kanga.nu [mailto:mud-dev-admin@kanga.nu]On Behalf Of
> Chambers
> Sent: Monday, May 14, 2001 1:46 PM
> To: mud-dev@kanga.nu
> Subject: [MUD-Dev] Multithreaded servers using objects

> The basic way a server works is create a thread, wait for a
> connection, accept connection and create new listener, then do the

Here's how my servers that spawn worker threads work:

  1) Create listener socket.
  2) Listener accepts new connects and spawns new thread.
  
Only one listener socket is created (well, you can have more than one
but that is another scenario) for the server.

> connection.  Most of the time this is done through a global
> function.  Is it possible, to instead do all your threading within
> member functions?  I.E write one server class that does the spin-off
> threads from it's private functions/data ?

Yes, it is possible to do your threading within member functions. I
can send you an example of how to do this if you would like.

I suggest you not spin off multiple threads of the server class. This
isn't very scalable and multiple threads on a single processor can be
problematic.  Essentially, with too many threads, the task switching
at the OS level would be enough to 'kill' the server.

I think there is another thread discussing the use of I/O completion
ports that may interest you. There are also knowledge base articles on
the MSDN site.

Dave "Dak Lozar" Loeser

_______________________________________________
MUD-Dev mailing list
MUD-Dev@kanga.nu
https://www.kanga.nu/lists/listinfo/mud-dev