jlislo
asked on
How to get ip address?
How to find out
1. IP Address of current PC
2. Name of the PC
Thanks
1. IP Address of current PC
2. Name of the PC
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks
ASKER
PHostEnt
What is this?
What is this?
I'd use the MAX address example, the UDDF one is for Delphi 1...
Cheers,
Raymond.
Cheers,
Raymond.
ASKER
Max sample give me only the last set of my pc's ip address. How can I get the first three set.
I post another question for gateway ip and host ip, if you know the answer feel free to get the points.
Thanks
I post another question for gateway ip and host ip, if you know the answer feel free to get the points.
Thanks
So it is... PHostEnt is defined in WinSock in D4 - the code should work in D4...
Cheers,
Raymond.
Cheers,
Raymond.
function my_ip_address:longint;
const
bufsize=255;
var
buf: pointer;
RemoteHost : PHostEnt; (* No, don't free it! *)
begin
buf:=NIL;
try
getmem(buf,bufsize);
winsock.gethostname(buf,bu
RemoteHost:=Winsock.GetHos
if RemoteHost=NIL then
my_ip_address:=winsock.hto
else
my_ip_address:=longint(poi
finally
if buf<>NIL then freemem(buf,bufsize);
end;
result:=winsock.ntohl(resu
end;
Cheers,
Raymond.