This sample represents a DNS server that responds with an in-memory list of IPs based on the name submitted.
In short, you need to use the OnGetHandedRecords event of the TclDnsServer component. The event handler may look like the following:
procedure TForm1.clDnsServer1GetHandedRecords(Sender: TObject;
AConnection: TclUdpUserConnection; const AName: string; ARecords: TclDnsRecordList);
rec := TclDnsARecord.Create();
rec.Name := AName;
rec.IPAddress := '111.222.333.444';
rec.TTL := 60000;
For sure, the complete DNS server should analyze the AName parameter, should add additional DNS records, such as SOA, NS and possible MX.
Please download the complete sample by using the link above.
Article ID: 89, Created: February 13, 2017 at 11:48 AM, Modified: March 17, 2020 at 2:31 PM