Click to See Complete Forum and Search --> : Client\Server apps


vodester
March 28th, 2001, 08:13 AM
I have written a client server app which works fine. What I want is rather than to create a new instance of the server app each time a client connects, for all the clients to use the same instance. So effectively multiple clients connecting to one server. The reason for this is that I wish all the client's to share the same variable value which can be amended by each client.
Any ideas of how I can achieve this, or sample code.

Thanks.

James Longstreet
March 28th, 2001, 02:54 PM
You can do it by creating a singleton object. One instance of the interface will be created and used by other processes. I don't know how you can do this in VB, in C++ you have a macro called
DECLARE_CLASSFACTORY_SINGLETON().

Use the MSDN and lookup singletons or book Professional ATL/COM programming by Richard Grimes might give you some ideas.

Jim Hewitt
Software Developer
Liberty Tax Service
www.LibertyTax.com