Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Jun : TIdComponent.OnStatus not triggered on TIdTCPServer disconnect?

www.cryer.info
Managed Newsgroup Archive

TIdComponent.OnStatus not triggered on TIdTCPServer disconnect?

Subject:TIdComponent.OnStatus not triggered on TIdTCPServer disconnect?
Posted by:"Mark Huebner" (mhuebn..@bostwicklaboratories.com)
Date:Thu, 28 Jun 2007 18:05:47

I have a Windows service application with the following code:

IdTCPServer := TIdTCPServer.Create(Self);
IdTCPServer.OnExecute := IdTCPServerExecute ;
IdTCPServer.OnStatus := IdTCPServerCheckIfDisconnected ;
IdTCPServer.Active := true ;

procedure IdTCPServerExecute(AThread: TIdPeerThread) ;
begin
    .
    .
    .
      AThread.Connection.Disconnect ;
end ;

procedure IdTCPServerCheckIfDisconnected(ASender: TObject; const AStatus:
TIdStatus; const AStatusText: string) ;
begin
   if AStatus = hsDisconnected then
      OutputWorkList ;
end ;

After AThread.Connection.Disconnect is executed in IdTCPServerExecute (and
the procedure exits), the procedure IdTCPServerCheckIfDisconnected never
gets called.  It thought it would be called.  What am I doing wrong?  Hasn't
the connection status changed?  Thanks!

Replies:

www.cryer.info
Managed Newsgroup Archive