Hello Veit, Connect as whell as other methods can raise exceptions in case of failure. This because there has to be something prepare to connect in this case.
Then the real connection happens in background and you dont have to worry for exceptions. If there are they are internally handled. If connect fails then OnSessionConnected will fire with a winsock error. Good idea is to put some code in OnBgException of TWSocket. It can fire if you have an unhandled exception in your code. --- Rgds, Wilfried [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html http://www.mestdagh.biz Friday, January 26, 2007, 08:32, Veit Zimmermann wrote: > Hello Wilfried > Thanks for your reply. The answer is a surprise for me: > Of course I know try except/finally, but why does it work when I > wrap it around TnCnx.Connect? I thought this is an asynchronous > method? But it works. I would have expected that the try/except > block is left right after calling connect and not only until the > connection is established or an exception occurs. Could you please > explain this? > Veit > Wilfried Mestdagh wrote: >> Hello Veit, >> >> Normally the components handles their own exception by design (as it >> should be). Be sure you have no exceptions in events. If there is a >> chance that your code can raise an exception then you should have that >> event into an try excpet block and handle it. >> >> --- >> Rgds, Wilfried [TeamICS] >> http://www.overbyte.be/eng/overbyte/teamics.html >> http://www.mestdagh.biz >> >> Thursday, January 25, 2007, 17:04, Veit Zimmermann wrote: >> >>> Hi >> >>> May be I'm missing something, but... >>> How can I catch an exception raised by an asynchronous function like >>> TnCnx.Connect in a form. In a TApplication there is a Method for this >>> (HandleException). Is there something similar for a TForm? >> >>> TIA >>> Veit > -- > ********************************************************************* > * Dipl.-Ing. Veit Zimmermann [EMAIL PROTECTED] * > * VECTRONIC Aerospace GmbH www.vectronic-aerospace.com * > * Carl-Scheele-Str. 12 tel: +49 (0)30 6789 4990 * > * D-12489 Berlin fax: +49 (0)30 6789 5230 * > * Germany WGS84: 52°25.83'N 13°31.52'E * > ********************************************************************* -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be