Board index » delphi » Com server wants to delete Com clients

Com server wants to delete Com clients

Hi,

I have a Com Server that occasionally checks to see if it clients are
still attached. This is because the clients are remote and there is a
possibility that the clients fails or the connection fails. In this
case I want the server to remove the client from the client list. I
once heard there was a function to do this but I forgot.

Can anyone help me?

Wim

 

Re:Com server wants to delete Com clients


The function your thinking of CoDisconnectObject. Disconnects all remote
process connections being maintained on behalf of all the interface pointers
on a specified object. Only the process that actually manages the object
should call CoDisconnectObject.

Quote
"Wim Bekker" <wim@#NOSPAM#divirec.com> wrote in message

news:98kksl$cen2@bornews.inprise.com...
Quote
> Hi,

> I have a Com Server that occasionally checks to see if it clients are
> still attached. This is because the clients are remote and there is a
> possibility that the clients fails or the connection fails. In this
> case I want the server to remove the client from the client list. I
> once heard there was a function to do this but I forgot.

> Can anyone help me?

> Wim

Re:Com server wants to delete Com clients


As I am very newbee I have the Impl class but how do I get the
IUnknown pointer?

Wim

Scott Kellish <skell...@siemens-hearing.com> schreef in berichtnieuws
98lf6l$b...@bornews.inprise.com...

Quote
> The function your thinking of CoDisconnectObject. Disconnects all
remote
> process connections being maintained on behalf of all the interface
pointers
> on a specified object. Only the process that actually manages the
object
> should call CoDisconnectObject.

> "Wim Bekker" <wim@#NOSPAM#divirec.com> wrote in message
> news:98kksl$cen2@bornews.inprise.com...
> > Hi,

> > I have a Com Server that occasionally checks to see if it clients
are
> > still attached. This is because the clients are remote and there
is a
> > possibility that the clients fails or the connection fails. In
this
> > case I want the server to remove the client from the client list.
I
> > once heard there was a function to do this but I forgot.

> > Can anyone help me?

> > Wim

Re:Com server wants to delete Com clients


As I am very newbee I have the Impl class but how do I get the
IUnknown pointer?

Wim

Scott Kellish <skell...@siemens-hearing.com> schreef in berichtnieuws
98lf6l$b...@bornews.inprise.com...

Quote
> The function your thinking of CoDisconnectObject. Disconnects all
remote
> process connections being maintained on behalf of all the interface
pointers
> on a specified object. Only the process that actually manages the
object
> should call CoDisconnectObject.

> "Wim Bekker" <wim@#NOSPAM#divirec.com> wrote in message
> news:98kksl$cen2@bornews.inprise.com...
> > Hi,

> > I have a Com Server that occasionally checks to see if it clients
are
> > still attached. This is because the clients are remote and there
is a
> > possibility that the clients fails or the connection fails. In
this
> > case I want the server to remove the client from the client list.
I
> > once heard there was a function to do this but I forgot.

> > Can anyone help me?

> > Wim

Re:Com server wants to delete Com clients


<<Wim Bekker:
As I am very newbee I have the Impl class but how do I get
the IUnknown pointer?

Quote

I am not sure what you are asking. If you have an
interface,

  IMyIntf = interface(IDispatch)
  ['{4D733280-C514-11D4-8481-A68F52CBDB56}']
    procedure ConfessAll;
  end;

and an object that implements that interface,

  TMyDispatchObj = class(TAutoObject, IMyDispatchIntf)
    public
      procedure ConfessAll;
  end;

you can create the object, and then get any other interface
that it implements from it (including IUnknown), like this
for example:

var
  Intf: IMyIntf;
  Unk: IUnknown;
begin
  Intf := TMyObj.Create;
  Unk := Intf as IUnknown;

If that doesn't help, perhaps you could give more
information about your code and what you are trying to do.

--
Deborah Pate (TeamB) http://delphi-jedi.org

  Use Borland servers; TeamB don't see posts via ISPs
  http://www.borland.com/newsgroups/genl_faqs.html

Re:Com server wants to delete Com clients


I've created a Tlib (using CPPBuilder). It has a CoClass DvrMessageAO
with an interface IDvrMessageAO and disp interface
IDvrMessageAOEvents.
Builder creates DvrMessageServer_TLB which defines the CoClass and
interfaces. It also creates the file DvrMessageAOImpl which defines:

class ATL_NO_VTABLE TDvrMessageAOImpl :
  public CComObjectRootEx<CComSingleThreadModel>,
  public CComCoClass<TDvrMessageAOImpl, &CLSID_DvrMessageAO>,
  public IConnectionPointContainerImpl<TDvrMessageAOImpl>,
  public TEvents_DvrMessageAO<TDvrMessageAOImpl>,
  public IDispatchImpl<IDvrMessageAO, &IID_IDvrMessageAO,
&LIBID_DvrMessageServer>

For creating clients I have imported the type-lib, create a component
from it and use the component to access the server. This all works
fine allthough it seems that I cannot have TVariant types returned by
the client.

When a client connects to the server (also remote) there is an
instance of TDvrMessageAOImpl created (I don't know yet how). The
functions of this class use the exe (a TForm descendant) to perform
the tasks.

Because it is possible that clients get disconnected without informing
the server the servers sometimes get left with instances that are not
connected to clients anymore. I want the server to be able to delete
these instances. Also I want the server to be able to disconnect these
instances/clients. I can just delete the pointer but than get some
complaints.

I've tried CoDisconnectObject(reinterpret_cast<IUnknown*>(the
TDvrMessageAOImpl instance) but this is not a valid interface so this
doesn't work.

Wim

It is a EXE-server . Builder creates some files

Quote
> <<Wim Bekker:
> As I am very newbee I have the Impl class but how do I get
> the IUnknown pointer?

> I am not sure what you are asking. If you have an
> interface,

>   IMyIntf = interface(IDispatch)
>   ['{4D733280-C514-11D4-8481-A68F52CBDB56}']
>     procedure ConfessAll;
>   end;

> and an object that implements that interface,

>   TMyDispatchObj = class(TAutoObject, IMyDispatchIntf)
>     public
>       procedure ConfessAll;
>   end;

> you can create the object, and then get any other interface
> that it implements from it (including IUnknown), like this
> for example:

> var
>   Intf: IMyIntf;
>   Unk: IUnknown;
> begin
>   Intf := TMyObj.Create;
>   Unk := Intf as IUnknown;

> If that doesn't help, perhaps you could give more
> information about your code and what you are trying to do.

> --
> Deborah Pate (TeamB) http://delphi-jedi.org

>   Use Borland servers; TeamB don't see posts via ISPs
>   http://www.borland.com/newsgroups/genl_faqs.html

Other Threads