Board index » delphi » More Questions about Automation Servers in NT Services

More Questions about Automation Servers in NT Services

I have an automation server, implemented in an NT service.  (which works
very well now - thanks to Binh Ly for tip about LocalService value in AppId
key).  I have a few questions related to shutting the service down.

When a remote DCOM client connects, the NT service starts up automatically.
This works just fine.  However, after the last client has closed, the
service remains started.  When all DCOM clients have disconnected, I want
the NT service to shut down.  What is the best way to do this?

If a client "disappears" (the end user just turns off their machine, for
example) hwo does the server know that the client is gone?  Is there a time
delay? If so, can it be reduced?

thanks,

Frazer Smith
p...@sesqui.spamwhacker.mtt.net

(remove the spamwhacker for a successful direct mail experience)

 

Re:More Questions about Automation Servers in NT Services


If I remember correctly, there is a reference counting issue with dcom.
You might try doing your own reference counting

cheers

Frazer Smith <p...@sesqui.spamwhacker.mtt.net> wrote in article
<7akcjb$g...@forums.borland.com>...

Quote
> I have an automation server, implemented in an NT service.  (which works
> very well now - thanks to Binh Ly for tip about LocalService value in
AppId
> key).  I have a few questions related to shutting the service down.

> When a remote DCOM client connects, the NT service starts up
automatically.
> This works just fine.  However, after the last client has closed, the
> service remains started.  When all DCOM clients have disconnected, I want
> the NT service to shut down.  What is the best way to do this?

> If a client "disappears" (the end user just turns off their machine, for
> example) hwo does the server know that the client is gone?  Is there a
time
> delay? If so, can it be reduced?

> thanks,

> Frazer Smith
> p...@sesqui.spamwhacker.mtt.net

> (remove the spamwhacker for a successful direct mail experience)

Re:More Questions about Automation Servers in NT Services


Well, counting new client connections seems easy enough.  I can add a global
variable in the implementation unit and inc( ) it every time the
TAutoObject's Initialization procedure is entered.  This seems to work OK.
Question is:  how do I detect client disconnects?  And, assuming I can do
that - what approach should I take to shutting down the NT Service, when my
counter reachs zero.

BTW, this seems like a kludge to me - should I not be able to use refcount
somehow?

Frazer.

Quote
Ted Dennis <tden...@phyx.net> wrote in message

news:01be5c59$0e3bd700$3f1e3e0a@tdeniss...
Quote
>If I remember correctly, there is a reference counting issue with dcom.
>You might try doing your own reference counting

>cheers

>Frazer Smith <p...@sesqui.spamwhacker.mtt.net> wrote in article
><7akcjb$g...@forums.borland.com>...
>> I have an automation server, implemented in an NT service.  (which works
>> very well now - thanks to Binh Ly for tip about LocalService value in
>AppId
>> key).  I have a few questions related to shutting the service down.

>> When a remote DCOM client connects, the NT service starts up
>automatically.
>> This works just fine.  However, after the last client has closed, the
>> service remains started.  When all DCOM clients have disconnected, I want
>> the NT service to shut down.  What is the best way to do this?

>> If a client "disappears" (the end user just turns off their machine, for
>> example) hwo does the server know that the client is gone?  Is there a
>time
>> delay? If so, can it be reduced?

>> thanks,

>> Frazer Smith
>> p...@sesqui.spamwhacker.mtt.net

>> (remove the spamwhacker for a successful direct mail experience)

Re:More Questions about Automation Servers in NT Services


Quote
Frazer Smith <p...@sesqui.spamwhacker.mtt.net> wrote in message

news:7akcjb$gme9@forums.borland.com...

----------

Quote
>If a client "disappears" (the end user just turns off their machine, for
>example) hwo does the server know that the client is gone?  Is there a time
>delay? If so, can it be reduced?

found answer to these questions:

DCOM clients ping the server every 2 minutes.  After 3 successive failures,
the server considers the client dead and decriments the reference count.
The time interval is not configurable.

F.

Re:More Questions about Automation Servers in NT Services


TAutoObject Destroy method.

(could those be trees over there in that forest?)

Quote
Frazer Smith <p...@sesqui.spamwhacker.mtt.net> wrote in message

news:7akht1$gmb15@forums.borland.com...
Quote
>Well, counting new client connections seems easy enough.  I can add a
global
>variable in the implementation unit and inc( ) it every time the
>TAutoObject's Initialization procedure is entered.  This seems to work OK.
>Question is:  how do I detect client disconnects?  And, assuming I can do
>that - what approach should I take to shutting down the NT Service, when my
>counter reachs zero.

>BTW, this seems like a kludge to me - should I not be able to use refcount
>somehow?

>Frazer.

>Ted Dennis <tden...@phyx.net> wrote in message
>news:01be5c59$0e3bd700$3f1e3e0a@tdeniss...
>>If I remember correctly, there is a reference counting issue with dcom.
>>You might try doing your own reference counting

>>cheers

>>Frazer Smith <p...@sesqui.spamwhacker.mtt.net> wrote in article
>><7akcjb$g...@forums.borland.com>...
>>> I have an automation server, implemented in an NT service.  (which works
>>> very well now - thanks to Binh Ly for tip about LocalService value in
>>AppId
>>> key).  I have a few questions related to shutting the service down.

>>> When a remote DCOM client connects, the NT service starts up
>>automatically.
>>> This works just fine.  However, after the last client has closed, the
>>> service remains started.  When all DCOM clients have disconnected, I
want
>>> the NT service to shut down.  What is the best way to do this?

>>> If a client "disappears" (the end user just turns off their machine, for
>>> example) hwo does the server know that the client is gone?  Is there a
>>time
>>> delay? If so, can it be reduced?

>>> thanks,

>>> Frazer Smith
>>> p...@sesqui.spamwhacker.mtt.net

>>> (remove the spamwhacker for a successful direct mail experience)

Re:More Questions about Automation Servers in NT Services


Maybe my memory has totally failed me...I was thinking that it was an
issue where there was always 1 more than the correct count.  If so,
just force it to zero when it is 1.  You'll have to check this, I
could be totally off.  I will check as well if I get the opportunity.

On Fri, 19 Feb 1999 16:43:57 -0400, "Frazer Smith"

Quote
<p...@sesqui.spamwhacker.mtt.net> wrote:

>Frazer Smith <p...@sesqui.spamwhacker.mtt.net> wrote in message
>news:7akcjb$gme9@forums.borland.com...

>----------

>>If a client "disappears" (the end user just turns off their machine, for
>>example) hwo does the server know that the client is gone?  Is there a time
>>delay? If so, can it be reduced?

>found answer to these questions:

>DCOM clients ping the server every 2 minutes.  After 3 successive failures,
>the server considers the client dead and decriments the reference count.
>The time interval is not configurable.

>F.

Re:More Questions about Automation Servers in NT Services


Frazer,

Quote
>I have an automation server, implemented in an NT service.  (which works
>very well now - thanks to Binh Ly for tip about LocalService value in AppId
>key).  I have a few questions related to shutting the service down.

If you really want to implement the DCOM server in NT service I recommend to
read my article about it (see Discussion at
http://www.chat.ru/~aldyn/svcom_frame.html). Unfortunately the combination
of Delphi 4 TService+TAutoObject (or any other com server from ActiveX page)
results to the "DCOM-server-NEAR-service" not a "DCOM-server-IN-service". It
works in simple examples but due to some internal problems it does not work
as required. We have discussed this problem with Binh Ly a couple of months
ago in this group and he confirms that the problem persists. I suggest the
SvCom tool as a solution of this problem. Try it. It is almost freeware (nag
screeen++; sources--; no other limitations).

Be happy

--
Be happy
Alexey Dynnikov <al...@chat.ru>
http://www.chat.ru/~aldyn
ICQ 18267212

Other Threads