Re: ATL COM Server exits when client exits

From: Ganesh Okade (ganeshokade_at_sunlux-india.com)
Date: 07/07/04


Date: 7 Jul 2004 12:32:52 -0700

Ben,
     Thanks again for your reply. For now, I have implemented my first
alternative (i.e. a dummy application holding on to the COM server)
and it seems to be working fine. The dummy application is a background
task with no windows and runs on system startup.
     Any alternative and cleaner method of implementation is welcome
from experts.

Regards,
Ganesh Okade
www.sunlux-india.com

Ben Rush <kwendex@yahoo.com> wrote in message news:<nsfke09vk8itjdi2vk87cei6ukiafhdj1d@4ax.com>...
> Ganesh,
>
> >Alternatively, I was wondering if I could create a dummy client
> >which will make a connection to the COM server and will always be
> >running "holding" the COM server from exiting. I know it is possible,
> >but would this be a good programming practice.
>
> As far as the second part of your question, is it a "good programming
> practice", I'm not sure. But the functionality you speak of is how COM
> cross-apartment communication occurs. When a remote activation request
> for a COM object is made through ORPC channels, the COM essentially
> connects with the correct COM apartment to call CoMarshalInterface on
> the requested interface (once it has been fully brought to life). This
> API returns what is called a stub manager which holds onto the object
> through IUnknown. The stub manager increments the ref count by 1 when
> it holds onto the remoted object, but maintains an internal reference
> count for each outstanding outer-apartment reference. When it detects
> all references are gone, it terminates and decrements its counter by
> 1, thereby removing itself and the object (given that it has no other
> outstanding references). All of this is pre-XPSP2.
>
> What all of this means is that COM already does this - so its
> possible. Potentially one could recommend to tred with caution,
> though, as doing something to short-circuit the COM's garbage
> collection capabilities could result in some very hard-to-debug code.
>
> One has to ask, though, how are you going to make sure that the
> object holding onto your object isn't deleted? Are you going to
> implement it as a service?
>
> >Alternatively, can I
> >make the COM server itself make some kind of a virtual connection to
> >itself so that the reference count is always greater than zero
> >preventing the application from exiting.
> > Thanks in advance for your valuable time.
> >
>
> This sounds like a more confusing version of the previous idea you
> had. Perhaps I'm missing something?
>
> >> Ben Rush
> >> http://my.mindvision.com/~ben/spoutlet/spoutings.html
>
> Ben Rush
> http://my.mindvision.com/~ben/spoutlet/spoutings.html



Relevant Pages

  • Re: 4-way Opteron vs. Xeon-IBM X3 architecture
    ... >>>The point here is that the issue concerns both speed AND capacity. ... >As to the reference, the message header points right back in this thread, ... >>>As you may suspect, I read plenty about memory systems, and I would ... >>>from the enthusiast market and assumed that it would work in the server ...
    (comp.sys.ibm.pc.hardware.chips)
  • Re: Web part development environment
    ... Just to verify: is the config you describe how you are set up? ... To create a Web Part, you need to add a reference to the ... you will need access to a server running Windows SharePoint Services. ... > from Microsoft and installed on the Dev machine. ...
    (microsoft.public.sharepoint.portalserver.development)
  • Re: Isolated Network Drift Problem
    ... they need some type of time reference if the master server becomes ... without a local clock reference will be able to provide time to NTP ... Isn't having an "apparently" synchronized NTP server better than ...
    (comp.protocols.time.ntp)
  • A tricky one for a beginner
    ... This is what I want to do: Save an object's data to a SQL Server 2000 ... - Many client machines. ... declarations of the business objects) that is shared by both the client ... and server object libraries - so that both have a reference to the ...
    (microsoft.public.dotnet.distributed_apps)
  • A tricky one...
    ... This is what I want to do: Save an object's data to a SQL Server 2000 ... - Many client machines. ... declarations of the business objects) that is shared by both the client ... and server object libraries - so that both have a reference to the ...
    (microsoft.public.dotnet.framework.remoting)