Hi David, Thanks
Regards Leigh -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of David Moorhouse Sent: Tuesday, August 07, 2007 10:50 AM To: NZ Borland Developers Group - Delphi List Subject: Re: [DUG] TIdPeerThread.BeforeRun Hi Leigh Post this one to the Indy NG. Remy will have you sorted in short order. Cheers D On Tue, 7 Aug 2007 10:13:50 +1200, you wrote: >Good morning, > >I am using indy 9.0.18 to in a tcp client/server application. > >Here is the code which I have trouble in IdTCPServer.pas > >procedure TIdPeerThread.BeforeRun; >begin > try > if Assigned(Connection.IOHandler) then begin > Connection.IOHandler.AfterAccept; > end > else begin > raise EIdTCPServerError.Create(''); > end; > except > Terminate; //APR: was FreeOn Terminate := True; ?! It is ThreadMgr work > raise; > end; > if Assigned(Connection.Server.Intercept) then begin > Connection.Intercept := Connection.Server.Intercept.Accept(Connection); > end; > Connection.Server.DoConnect(Self); <--- The problem > > // Stop this thread if we were disconnected > if not Connection.Connected then begin > Stop; > end; >end; > >It is quite common to face Socket Error #10054 Connection reset by peer. I >can use normanl try except block on tcp client application to catch the >error and handle it. But what about tcp server? > >If Connection.Server.DoConnect(Self); got Socket Error #10054, it will just >let indy routine to handle it. That is not I want. I want to handle this >error myself. How to catch it? Will event OnException of TIdTCPServer pass >the exception to my event handling delphi code? > >I really don't want to modify indy code. > >TIA > >Regards >Leigh > > >_______________________________________________ >NZ Borland Developers Group - Delphi mailing list >Post: [email protected] >Admin: http://delphi.org.nz/mailman/listinfo/delphi >Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe _______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: [email protected] Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe _______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: [email protected] Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe
