🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #4612

Re: host name to ip

#4612
From: Remy Lebeau (TeamB)
Date: Tue, 18 Jan 2005 17:32
26 lines
1473 bytes
"duncan" <duncan.winn@smiths-aerospace.com> wrote in message
news:41ecf12e$1@newsgroups.borland.com...

> Does anyone know of a command or way of converting from a host name to IP
address and visa versa.

    #include <winsock2.h>

    hostent *pHost = gethostbyname("somehost");
    if( phost )
    {
        AnsiString IP = inet_ntoa( *( (in_addr *)pHost->h_addr ) );
        //...
    }

    u_long addr = inet_addr("213.54.23.128");
    pHost = gethostbyaddr((char*)&addr, sizeof(addr), AF_INET);
    if( pHost )
    {
        AnsiString Host = pHost->h_name;
        //...
    }


Gambit
Technical Details
Message-ID: <41ed47be@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <41ecf12e$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,5df03dd94d1f099f
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <41ecf12e$1@newsgroups.borland.com>
Subject: Re: host name to ip
Date: Tue, 18 Jan 2005 09:32:47 -0800
Lines: 28
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <41ed47be@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1106069438 68.69.17.41 (18 Jan 2005 09:30:38 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail