Article View: borland.public.cppbuilder.nativeapi
Article #14597Re: IP adrress of a network computer
From: Eyyub Volkan �ektimur
Date: Fri, 08 Aug 2003 15:34
Date: Fri, 08 Aug 2003 15:34
50 lines
1959 bytes
1959 bytes
you can use
gethostbyname
function, it returns HOSTENT
struct hostent {
char FAR * h_name;
char FAR * FAR * h_aliases;
short h_addrtype;
short h_length;
char FAR * FAR * h_addr_list;
};
"h_addr_list" contains IP address
h_addr_list
A NULL-terminated list of addresses for the host. Addresses are returned in
network byte order. The macro h_addr is defined to be h_addr_list[0] for
compatibility with older software.
you can refer to "gethostbyname" in MSDN
don't forget to include
#include <ScktComp.hpp>
--
___________________________________
Eyyub Volkan �ektimur
Proya Software & Trade Inc.
Head of Core Development Department
<Jan Piessens> wrote in message news:3f336b2a$1@newsgroups.borland.com...
> Hi all,
>
> I can find all the computers in a network with the function
WNetEnumResource(), but is there a way to find also the IP adrress of a
computer in a network ?
>
> Thanks,
> Jan
Technical Details
Message-ID:
<3f33c2fd@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!news-out.visi.com!petbe.visi.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3f336b2a$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 10cc67,68e5ffe7c328d7f6 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-08-08 08:38:00 PST From: "Eyyub Volkan �ektimur" <evcektimur@prokon.com.tr> Newsgroups: borland.public.cppbuilder.nativeapi References: <3f336b2a$1@newsgroups.borland.com> Subject: Re: IP adrress of a network computer Date: Fri, 8 Aug 2003 18:34:21 +0300 Lines: 52 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 213.232.9.4 Message-ID: <3f33c2fd@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1060356861 213.232.9.4 (8 Aug 2003 08:34:21 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!news-out.visi.com!petbe.visi.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail