🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: be.comp.programming
Article #15939

Re: IP adres naar hostname

#15939
From: Roel Koops
Date: Sat, 22 Jul 2000 00:00
24 lines
1508 bytes
"surfer" <surfer@here.nl> wrote in message
news:iyXd5.96320$Ji7.1723350@afrodite.telenet-ops.be...
> Hoe kan ik (liefst in Visual C++) een hostname achterhalen adhv. een IP
> adres?
> Dus bv. van 111.111.111.111 naar www.domain.com

Als Delphi ook goed is probeer dan eens dit:

function TASPGetRealName.IPAddrToName(IPAddr : String): String;
var
  SockAddrIn: TSockAddrIn;
  HostEnt: PHostEnt;
  WSAData: TWSAData;
begin
  WSAStartup($101, WSAData);
  SockAddrIn.sin_addr.s_addr:= inet_addr(PChar(IPAddr));
  HostEnt:= gethostbyaddr(@SockAddrIn.sin_addr.S_addr, 4, AF_INET);   if
HostEnt<>nil then
    result:=StrPas(Hostent^.h_name)
  else
    result:='';
end;

Roel Koops
Technical Details
Message-ID: <67fe5.108719$6x6.1695702@news.rdc1.ov.nl.home.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <iyXd5.96320$Ji7.1723350@afrodite.telenet-ops.be>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 107324,366090c021d28141
X-Google-Attributes: gid107324,public
X-Google-Thread: fcea4,366090c021d28141
X-Google-Attributes: gidfcea4,public
From: "Roel Koops" <rkoops@home.nl>
Subject: Re: IP adres naar hostname
Date: 2000/07/22
Message-ID: <67fe5.108719$6x6.1695702@news.rdc1.ov.nl.home.com>
X-Deja-AN: 649426491
References: <iyXd5.96320$Ji7.1723350@afrodite.telenet-ops.be>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700
X-Complaints-To: abuse@home.nl
X-Trace: news.rdc1.ov.nl.home.com 964263490 212.120.68.122 (Sat, 22 Jul 2000 12:58:10 MET DST)
Organization: @Home Network
X-MSMail-Priority: Normal
NNTP-Posting-Date: Sat, 22 Jul 2000 12:58:10 MET DST
Newsgroups: be.comp.programming,nl.comp.programmeren