Fórum Ip do Hamachi #353347
08/02/2008
0
Galera,
Em meu sistema incluo o IP do cara quando se loga. Mas é o IP da rede.
Eu utilizo um software de terceiro chamado Hamachi, ele simplesmente cria outra conexão com outro IP. Existe a possibilidade de eu pegar este Ip gerado por ele?
Obrigado
Em meu sistema incluo o IP do cara quando se loga. Mas é o IP da rede.
Eu utilizo um software de terceiro chamado Hamachi, ele simplesmente cria outra conexão com outro IP. Existe a possibilidade de eu pegar este Ip gerado por ele?
Obrigado
Tremonti
Curtir tópico
+ 0
Responder
Posts
15/02/2008
Dor_poa
Inclua na seção uses: WinSock
Opções:
function Micro_IpLocal:string;
var
WSAData: TWSAData;
HostEnt: PHostEnt;
Name:string;
begin
WSAStartup(2, WSAData);
SetLength(Name, 255);
Gethostname(PChar(Name), 255);
SetLength(Name, StrLen(PChar(Name)));
HostEnt := gethostbyname(PChar(Name));
with HostEnt^ do
begin
Result := Format(´¬d.¬d.¬d.¬d´,
[Byte(h_addr^[0]),Byte(h_addr^[1]),
Byte(h_addr^[2]),Byte(h_addr^[3])]);
end;
WSACleanup;
end;
Outra Situação:
Function Micro_IpInternet : string;
type
TaPInAddr = array [0..10] of PInAddr;
PaPInAddr = ^TaPInAddr;
var
phe : PHostEnt;
pptr : PaPInAddr;
Buffer : array [0..63] of char;
I : Integer;
GInitData : TWSADATA;
begin
WSAStartup($101, GInitData);
Result := ´´;
GetHostName(Buffer, SizeOf(Buffer));
phe :=GetHostByName(buffer);
if phe = nil then Exit;
pptr := PaPInAddr(Phe^.h_addr_list);
I := 0;
while pptr^[I] <> nil do begin
result:=StrPas(inet_ntoa(pptr^[I]^));
result := StrPas(inet_ntoa(pptr^[I]^));
Inc(I);
end;
WSACleanup;
end;
Opções:
function Micro_IpLocal:string;
var
WSAData: TWSAData;
HostEnt: PHostEnt;
Name:string;
begin
WSAStartup(2, WSAData);
SetLength(Name, 255);
Gethostname(PChar(Name), 255);
SetLength(Name, StrLen(PChar(Name)));
HostEnt := gethostbyname(PChar(Name));
with HostEnt^ do
begin
Result := Format(´¬d.¬d.¬d.¬d´,
[Byte(h_addr^[0]),Byte(h_addr^[1]),
Byte(h_addr^[2]),Byte(h_addr^[3])]);
end;
WSACleanup;
end;
Outra Situação:
Function Micro_IpInternet : string;
type
TaPInAddr = array [0..10] of PInAddr;
PaPInAddr = ^TaPInAddr;
var
phe : PHostEnt;
pptr : PaPInAddr;
Buffer : array [0..63] of char;
I : Integer;
GInitData : TWSADATA;
begin
WSAStartup($101, GInitData);
Result := ´´;
GetHostName(Buffer, SizeOf(Buffer));
phe :=GetHostByName(buffer);
if phe = nil then Exit;
pptr := PaPInAddr(Phe^.h_addr_list);
I := 0;
while pptr^[I] <> nil do begin
result:=StrPas(inet_ntoa(pptr^[I]^));
result := StrPas(inet_ntoa(pptr^[I]^));
Inc(I);
end;
WSACleanup;
end;
Responder
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)