Subject Re: [ib-support] Work with dynamic IP address?
Author Bob Lazarchik
Joe:

Try this. I believe I got it from Borland and it works for us. It gives
both the ip address and local machine name.


uses Winsock;

procedure GetHostInfo(var Name, Address: string);
var
WSAData: TWSAData;
HostEnt: PHostEnt;
begin
{ no error checking...}
WSAStartup(2, WSAData);
SetLength(Name, 255);
Gethostname(PChar(Name), 255);
SetLength(Name, StrLen(PChar(Name)));
HostEnt := gethostbyname(PChar(Name));
with HostEnt^ do
Address := Format('%d.%d.%d.%d',[
Byte(h_addr^[0]),
Byte(h_addr^[1]),
Byte(h_addr^[2]),
Byte(h_addr^[3])]);
WSACleanup;
end;

hth


Bob Lazarchik
Semiconductor Diagnostics.