Re: [twsocket] Using WSocket to get ip of domain
I know waiting in a loop is not the best way, but how else can I do it? I have a list of 4 domains that I want to get the ip address for.. Easy ! Just have a list of what you need to lookup, build a routine to start a lookup if there is something in the list. From the LookupDone event, you call again your start routine, until the luist is emptyed. No loop, no wait, pure event driven. -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) 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
Re: [twsocket] Using WSocket to get ip of domain
Arno, I know waiting in a loop is not the best way, but how else can I do it? I have a list of 4 domains that I want to get the ip address for.. -- Message: 3 Date: Wed, 21 Sep 2005 15:56:42 +0200 From: Arno Garrels [EMAIL PROTECTED] Subject: Re: [twsocket] Using WSocket to get ip of domain To: ICS support mailing twsocket@elists.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=iso-8859-1 Don't wait in a loop. Event OnDnsLookupDone is fired after the lookup has finished. Arno Garrels Nick wrote: But if you enter an invalid domain, or if you are not connected to the internet, no error is raised. I even wrote my own timer function to abort the process after 10 seconds but that doesn't work either. sIP is a global string Button1 click sIP := ''; WSocket1.Addr:= edSite.text; WSocket1.DnsLookup(edSite.text); While sIP = '' do Application.ProcessMessages; edIP.text := sIP; // And with WsockectDone event If Error0 then sIP := 'Error retrieving' else sIP := WSocket1.DnsResult; //= This works 90% of the time, but if the connection dies or the domain is invalid (like aaabbb.com) then it hangs totaly. Thanks alot :-) Nick -- -- 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
Re: [twsocket] Using WSocket to get ip of domain
Nick wrote: Arno, I know waiting in a loop is not the best way, but how else can I do it? I have a list of 4 domains that I want to get the ip address for.. procedure TForm1.Button1Click(Sender: TObject); begin MyHostList.Add('mail.gmx.de'); MyHostList.Add('pop.gmx.de'); WSocket1.DnsLookup(MyHostList[0]); end; procedure TForm1.WSocket1DnsLookupDone(Sender: TObject; ErrCode: Word); begin if ErrCode = 0 then Memo1.Lines.Add(WSocket1.DnsResult) else Memo1.Lines.Add(WSocketErrorDesc(ErrCode)); if MyHostList.Count 0 then MyHostList.Delete(0); if MyHostList.Count 0 then WSocket1.DnsLookup(MyHostList[0]); end; Message: 3 Date: Wed, 21 Sep 2005 15:56:42 +0200 From: Arno Garrels [EMAIL PROTECTED] Subject: Re: [twsocket] Using WSocket to get ip of domain To: ICS support mailing twsocket@elists.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=iso-8859-1 Don't wait in a loop. Event OnDnsLookupDone is fired after the lookup has finished. Arno Garrels Nick wrote: But if you enter an invalid domain, or if you are not connected to the internet, no error is raised. I even wrote my own timer function to abort the process after 10 seconds but that doesn't work either. sIP is a global string Button1 click sIP := ''; WSocket1.Addr:= edSite.text; WSocket1.DnsLookup(edSite.text); While sIP = '' do Application.ProcessMessages; edIP.text := sIP; // And with WsockectDone event If Error0 then sIP := 'Error retrieving' else sIP := WSocket1.DnsResult; //= This works 90% of the time, but if the connection dies or the domain is invalid (like aaabbb.com) then it hangs totaly. Thanks alot :-) Nick -- -- 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
Re: [twsocket] Using WSocket to get ip of domain
Don't wait in a loop. Event OnDnsLookupDone is fired after the lookup has finished. Arno Garrels Nick wrote: But if you enter an invalid domain, or if you are not connected to the internet, no error is raised. I even wrote my own timer function to abort the process after 10 seconds but that doesn't work either. sIP is a global string Button1 click sIP := ''; WSocket1.Addr:= edSite.text; WSocket1.DnsLookup(edSite.text); While sIP = '' do Application.ProcessMessages; edIP.text := sIP; // And with WsockectDone event If Error0 then sIP := 'Error retrieving' else sIP := WSocket1.DnsResult; //= This works 90% of the time, but if the connection dies or the domain is invalid (like aaabbb.com) then it hangs totaly. Thanks alot :-) Nick -- 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