Eric Montréal wrote: > Wilfried Mestdagh wrote: > >> Hello Eric, >> >> Check out DnsQuery component, I think that's what you need. >> >> >> > I looked at tDnsQuery, but this part of DNS is still some kind of > mysterious art to me ... > > The component gives me the IP for a domain, but, I have no idea how to > use it to get > the DNS server's IP (or name) for a domain instead of the domain's IP > itself.
Domains do not own an IP, but hosts do :) However you are right, as far as I understand the component there's in fact no method implemented to get the name server of a domain. However I think it's easy to add, try something like: function TDnsQuery.NSLookup(Domain : String) : Integer; begin Inc(FIDCount); BuildRequestHeader(PDnsRequestHeader(@FQueryBuf), FIDCount, DnsOpCodeQuery, TRUE, 1, 0, 0, 0); FQueryLen := BuildQuestionSection(@FQueryBuf[SizeOf(TDnsRequestHeader)], Domain, DnsQueryNS, DnsClassIN); FQueryLen := FQueryLen + SizeOf(TDnsRequestHeader); Result := FIDCount; SendQuery; end; In procedure TDnsQuery.WSocketDataAvailable(Sender: TObject; Error: WORD); .. add ==> DnsQueryNS, DnsQueryPTR: begin if FPTRRecordCount <= High(FHostnameArray) then begin FAnswerTagArray[I] := FPTRRecordCount; DecodePTRData(@FResponseBuf, RDataPtr, FHostnameArray[FPTRRecordCount]); ... Check DnsQuery.Hostname[n] in DnsQuery.OnRequestDone, is it working for you? -- 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