Hello Francois, > The code is OK for both those using OnError and those using exception > handling, IMO.
Yes, but behaviour is different. In this case (ok it is stupid from programmer's view to not check it, but..) DNSLookupDone is only called with an error if event handler is assigned to OnError, which normally is not the case for someone who can deal with exceptions. I have no problem with it (code has always been like this), but I think an emtpy host name should call DNSLookup with an error in any case, not only when OnError has a handler. ... or never, but I think behavour should be same with or without assigned OnError... Oh whell it is only a minor thing... My yongest son will married tomorrow for law (saterday for church), so I'm very busy with other "exceptions" for the party etc.. :) Hell I still have to search if I have a cravate... --- Rgds, Wilfried http://www.mestdagh.biz Wednesday, August 17, 2005, 13:20, Francois Piette wrote: >> Assign something on the OnError is not the way to go. Should the >> RaiseException line not be commented out ? What do you think ? > The code is OK for both those using OnError and those using exception > handling, IMO. > -- > [EMAIL PROTECTED] > http://www.overbyte.be > ----- Original Message ----- > From: "Wilfried Mestdagh" <[EMAIL PROTECTED]> > To: <twsocket@elists.org> > Sent: Wednesday, August 17, 2005 11:57 AM > Subject: [twsocket] TWSocket DNSLookup >> Hello Francois, >> >> Strange after all these years I did not check the AHostName before >> calling DNSLookup for the first time :) >> >> Anyway there is something I wonder. First exception is raised, then >> TriggerDnsLookupDone is called with the right argument, however because >> the exception it is never called, and it should be with or without >> error. >> >> Assign something on the OnError is not the way to go. Should the >> RaiseException line not be commented out ? What do you think ? >> >> procedure TCustomWSocket.DnsLookup(const AHostName : String); >> var >> IPAddr : TInAddr; >> HostName : String; >> begin >> if AHostName = '' then begin >> RaiseException('DNS lookup: invalid host name.'); // comment ? >> TriggerDnsLookupDone(WSAEINVAL); >> Exit; >> end; >> >> -- >> Rgds, Wilfried >> http://www.mestdagh.biz >> >> -- >> 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 -- 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