Ver Mensaje Individual
  #1  
Antiguo 23-03-2007
aledieb aledieb is offline
Miembro
 
Registrado: jun 2005
Ubicación: Buenos Aires, Argentina
Posts: 141
Reputación: 19
aledieb Va por buen camino
Obterner el IP del nombre netbios de la PC

Hace un tiempo necesite obtener el número de IP de una máquina dentro de la red de la cual tenia solamente el nombre netbios, gracias a seoane que me dio la función pude resolver el problema.

[HTML]
http://www.clubdelphi.com/foros/showthread.php?t=36690
[/HTML]


Uses WinSock;
interface


Código Delphi [-]
function ObtenerIpdeNetbios(Host: string): string;


implementation


Código Delphi [-]
function ObtenerIpdeNetbios(Host: string): string;
var
  WSAData: TWSADATA;
  HostEnt: phostent;
begin
  Result:= '';
  if WSAStartup(MAKEWORD(1, 1), WSADATA) = 0 then
  begin
    HostEnt:= gethostbyname(PChar(Host));
    if HostEnt <> nil then
      Result:= String(inet_ntoa(PInAddr(HostEnt.h_addr_list^)^));
    WSACleanup;
  end;
end;
Responder Con Cita