BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How can a COM server determine that client is no longer ther

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi ActiveX Controls Development
View previous topic :: View next topic  
Author Message
Parmod
Guest





PostPosted: Sun Nov 09, 2003 5:21 am    Post subject: How can a COM server determine that client is no longer ther Reply with quote



I am trying to write a COM server and various COM clients. The code works
until the client crashes for some reason, at which point the server just
goes crazy trying to send events to the client who has passed away. Can
someone tell me how to determine that the client is no longer there. I use
the following code to send events.

Thanks in advance for your help.

Parmod

function GetConnectionEnumerator: IEnumConnections;
var
Container: IConnectionPointContainer;
CP: IConnectionPoint;
begin
Result := nil;
try
//+++++got error here
OleCheck(QueryInterface(IConnectionPointContainer, Container));
OleCheck(Container.FindConnectionPoint(AutoFactory.EventIID, CP));
OleCheck(CP.EnumConnections(Result));
except
on E: Exception do
ShowMessage('GetConnectionEnumerator: '+E.Message);
end;
end;


procedure OnAboutRequest;
var
EC: IEnumConnections;
ConnectData: TConnectData;
Fetched: Cardinal;
begin
EC := GetConnectionEnumerator;
if EC <> nil then
begin
while EC.Next(1, ConnectData, @Fetched) = S_OK do
if (Fetched = 1) and (ConnectData.pUnk <> nil) then
(ConnectData.pUnk as ISpeechXTrayEvents).OnAbout;
end;
end;


Back to top
Maynard Philbrook
Guest





PostPosted: Sun Nov 09, 2003 8:16 pm    Post subject: Re: How can a COM server determine that client is no longer Reply with quote



just post some kind of ping message to the client that has to echo back.


Parmod wrote:

Quote:
I am trying to write a COM server and various COM clients. The code works
until the client crashes for some reason, at which point the server just
goes crazy trying to send events to the client who has passed away. Can
someone tell me how to determine that the client is no longer there. I use
the following code to send events.

Thanks in advance for your help.

Parmod

function GetConnectionEnumerator: IEnumConnections;
var
Container: IConnectionPointContainer;
CP: IConnectionPoint;
begin
Result := nil;
try
//+++++got error here
OleCheck(QueryInterface(IConnectionPointContainer, Container));
OleCheck(Container.FindConnectionPoint(AutoFactory.EventIID, CP));
OleCheck(CP.EnumConnections(Result));
except
on E: Exception do
ShowMessage('GetConnectionEnumerator: '+E.Message);
end;
end;

procedure OnAboutRequest;
var
EC: IEnumConnections;
ConnectData: TConnectData;
Fetched: Cardinal;
begin
EC := GetConnectionEnumerator;
if EC <> nil then
begin
while EC.Next(1, ConnectData, @Fetched) = S_OK do
if (Fetched = 1) and (ConnectData.pUnk <> nil) then
(ConnectData.pUnk as ISpeechXTrayEvents).OnAbout;
end;
end;

--
To See what real programmers do in their spare time visit
http://jamie12.home.mindspring.com
home of PC bit software ..
Please send comments about my work .



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi ActiveX Controls Development All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.