RE: Getting an IP Address from a domain name
Thanks for the tips guys. Arno, that code works flawlessly. Steve Gaskin ProLink/BK On-Line/Website Dealer Marketing Services, Inc 5401 Elmore Avenue Davenport, IA 52807 Phone: (563) 344-7612 Fax: (563) 344-7728 Email: [EMAIL PROTECTED] This email may contain confidential privileged material for the sole use of the intended recipient. Any review or distribution by others is strictly prohibited. If you are not the intended recipient please contact the sender and delete all copies. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Arno Garrels Sent: Friday, July 07, 2006 2:48 AM To: Borland's Delphi Discussion List Subject: Re: Getting an IP Address from a domain name Hello Steve, to be a pain. I need to get the Host IP from a domain name, IE - www.skpontiac.com to 12.163.44.20 I don't know how it is done in Indy. But in ICS it is as simple as dropping a TWSocket on the form and writing a few lines. procedure TForm1.Button1Click(Sender: TObject); begin WSocket1.OnDnsLookupDone := WSocket1DnsLookupDone; WSocket1.DnsLookup('www.skpontiac.com'); end; procedure TForm1.WSocket1DnsLookupDone(Sender: TObject; ErrCode: Word); begin if ErrCode = 0 then Memo1.Lines.AddStrings(WSocket1.DnsResultList) else Memo1.Lines.Add(WSocket.WSocketErrorDesc(ErrCode)) end; The ICS (Internet Component Suite, freeware) is available on the partner CD or downloadable here http://www.overbyte.be. Arno Garrels ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi
Re: Getting an IP Address from a domain name
Hello Steve, try using the function GetHostByName which is part of the WinSock API. I believe that you can pass in the domain name and get back the IP address. It's all handled by the Windows Resolver and DNS cache mechanism. HTH, Stephen. ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi
Re: Getting an IP Address from a domain name
Ping the domain. That domain, btw, returns 65.125.108.20 from DNS and apparently wasn't online when pinged. Note that the IP could be different at different times, depending upon whether the host is using DHCP or dedicated IPs. Jerry At 06:03 PM 7/6/2006, you wrote: Hi All, I have a project that I thought would be a snap and it has turned out to be a pain. I need to get the Host IP from a domain name, IE - www.skpontiac.com to 12.163.44.20 Anyone have any tools or suggestion, I would greatly appreciate it. So far I have tried Indy 9.0 idDNSResolver with no success. Steve Gaskin ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi
Re: Getting an IP Address from a domain name
Hello Steve, to be a pain. I need to get the Host IP from a domain name, IE - www.skpontiac.com to 12.163.44.20 I don't know how it is done in Indy. But in ICS it is as simple as dropping a TWSocket on the form and writing a few lines. procedure TForm1.Button1Click(Sender: TObject); begin WSocket1.OnDnsLookupDone := WSocket1DnsLookupDone; WSocket1.DnsLookup('www.skpontiac.com'); end; procedure TForm1.WSocket1DnsLookupDone(Sender: TObject; ErrCode: Word); begin if ErrCode = 0 then Memo1.Lines.AddStrings(WSocket1.DnsResultList) else Memo1.Lines.Add(WSocket.WSocketErrorDesc(ErrCode)) end; The ICS (Internet Component Suite, freeware) is available on the partner CD or downloadable here http://www.overbyte.be. Arno Garrels ___ Delphi mailing list - Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi