Delphi .NET (2) Database (71) Delphi IDE (90) Network (39) Printing (3) Strings (12) VCL (83) Windows with Delphi (280)
Exchange Links About this site Links to us 
New related comments Number of comments in the last 48 hoursError: 'RPC Server is unavailable' 1 new comments
|
Changing the TCP/IP DNS address
This article has not been rated yet. After reading, feel free to leave comments and rate it.
A Domain Name Server convert mnemonic internet addresses to their natural numeric IP addresses e.g. preview.org = 209.204.209.81
If you have a need to dynamically change your DNS servers from your program, you can do so by calling the the following
 | |  | | uses
Registry;
procedure SaveStringToRegistry_LOCAL_MACHINE (sKey, sItem, sVal: string);
var
Reg : TRegIniFile;
begin
Reg := TRegIniFile.create ('');
Reg.RootKey := HKEY_LOCAL_MACHINE;
Reg.WriteString (sKey, sItem, sVal + #0);
Reg.Free
end;
procedure SetTCPIPDNSAddresses (sIPs: string);
begin
if RunningWinNT then
begin
SaveStringToRegistry_LOCAL_MACHINE (
'SYSTEM\CurrentControlSet\Services\Tcpip\Parameters',
'NameServer', sIPs)
end
else
begin
SaveStringToRegistry_LOCAL_MACHINE (
'SYSTEM\CurrentControlSet\Services\VxD\MSTCP',
'NameServer', sIPs)
end
end;
| |  | |  |
Comments:
|
|
|
|
But.. can i get a DNS address if i dont have a domain?
-Teis
|
|