Article View: borland.public.cppbuilder.nativeapi
Article #14473Re: IP adrress of a network computer
From: Jan Piessens
Date: Mon, 11 Aug 2003 19:29
Date: Mon, 11 Aug 2003 19:29
26 lines
1232 bytes
1232 bytes
Eyyub Volkan Gektimur wrote:
> you can use
>
> gethostbyname
Hi,
I have fixed it with the next function:
#include <winsock.h>
#include <psock.hpp>
void __fastcall TForm1::GetComputerIP(String sHost)
{
hostent *phost;
char *ip;
phost = gethostbyname(sHost.c_str());
ip = inet_ntoa(*((in_addr *)phost->h_addr));
Edit2->Text = ip;
}
Thanks for the help.
Jan
Technical Details
Message-ID:
<3f37ee88@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-09!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3f336b2a$1@newsgroups.borland.com> <3f33c2fd@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,68e5ffe7c328d7f6 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-08-11 12:37:53 PST From: "Jan Piessens" <> Subject: Re: IP adrress of a network computer Newsgroups: borland.public.cppbuilder.nativeapi References: <3f336b2a$1@newsgroups.borland.com> <3f33c2fd@newsgroups.borland.com> Organization: JLC Soft User-Agent: XanaNews/1.15.3.2 NNTP-Posting-Host: 213.119.196.140 Message-ID: <3f37ee88@newsgroups.borland.com> Date: 11 Aug 2003 12:29:12 -0700 X-Trace: newsgroups.borland.com 1060630152 213.119.196.140 (11 Aug 2003 12:29:12 -0700) Lines: 26 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail