🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: How to get the configured subnet mask for this machine?

#2457
From: Remy Lebeau (TeamB)
Date: Thu, 13 Apr 2006 00:59
23 lines
1624 bytes
"Mike Knoblock" <mknoblock@gmail.com> wrote in message
news:443d7421$1@newsgroups.borland.com...

> Anyone know how to use WINAPI to retrieve the subnet mask
> for a given interface?

Look at the GetAdaptersInfo() function in the IPHLR API:

    GetAdaptersInfo
    http://msdn.microsoft.com/library/en-us/iphlp/iphlp/getadaptersinfo.asp

The IP_ADAPTER_INFO structure has several members that deal with IP
addresses and masks.  They are all of type IP_ADDR_STRING, which has an
IpMask member.

> I can programmatically retrieve a list of IP addresses with
> gethostbyname, but this doesn't deal with configured subnets.

There is nothing in the WinSock API for what you ask.


Gambit
Technical Details
Message-ID: <443da25e$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <443d7421$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,2192634693d412d8
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: <443d7421$1@newsgroups.borland.com>
Subject: Re: How to get the configured subnet mask for this machine?
Date: Wed, 12 Apr 2006 17:59:13 -0700
Lines: 25
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: <443da25e$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1144889950 68.69.17.41 (12 Apr 2006 17:59:10 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail