Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 504
  • Last Modified:

Detecting client disconnect in an out of process DCOM server.

Hi,

The title says it all.
Is it possible to detect a client disconnect from an out of process server so that some action may be taken.

I need to detect the not so graceful disconnects and reboots.

Thanks
Regards
Craig
0
cmain
Asked:
cmain
  • 3
  • 2
1 Solution
 
steve_hskCommented:
Hi Craig ...

yes of course you can detect this. It depends on how you have created and setup your sockets.

One method I use is Socket Network Events.

General Approximate Example ...

m_aSocketHandle := WSACreateEvent;

bind (m_tUDPSock, @m_tpAddress, sizeof(tSockAddrIn))

WSAEventSelect (m_tUDPSock, m_aSocketHandle, FD_READ OR FD_CLOSE)

dwWaitReturn := WaitForMultipleObjects (2,@m_aSocketHandle,
FALSE,INFINITE);

IF (dwEventTrig = 1 ) THEN
BEGIN
    IF NOT (WSAENUMNetworkEvents (m_tUDPSock, m_aSocketHandle, m_tpEvent) = SOCKET_ERROR) THEN
    BEGIN
         IF (m_tpEvent.lNetworkEvents = FD_READ) THEN
         BEGIN
              // Read Data;
         END
         ELSE IF (m_tpEvent.lNetworkEvents = FD_CLOSE) THEN
         BEGIN
              // Handle Closure
         END;
     END;
END;

If you need a full exmaple, or if I have the wrong concept, let me know :-)

Hope this Helps,
Steve
0
 
ziolkoCommented:
listening..
0
 
steve_hskCommented:
Craig,

sorry ... should have read the question properly ...

missed the DCOM KEY word ... will revise and get back to you after a couple of very strong coffee's !!!

Steve
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
ziolkoCommented:
You mean disconnect by syste or network cradh or disconnect by user's action??.
ziolko
0
 
steve_hskCommented:
Craig,

I've checked with a collegue, and apparently the short answer is no you can't detect. If your using a container like MTS or equivalent, then the Marshelling and overhead is automatically cleared up for you and so there is no need to detect, although this event isn't raised in the server side.

It's not the done thing to have the server check all it's clients are active either. So if you do require the detection of a client "crash", then you could design a simple transaction that each client would initiate with the server ... you're own "keep-alive" so to speak. The server would log these transactions, and when inspecting this record or log, raise the necessary event to your app code, for you to action accordingly.

Maybe this is a lil more helpful ?
Steve
0
 
cmainAuthor Commented:
Thanks
I have gathered that it is pretty much not possible without a lot of work.

Regards
Craig.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now