 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Mike Knoblock Guest
|
Posted: Wed Apr 12, 2006 11:03 pm Post subject: How to get the configured subnet mask for this machine? |
|
|
Anyone know how to use WINAPI to retrieve the subnet mask for a given
interface? I can programmatically retrieve a list of IP addresses with
gethostbyname, but this doesn't deal with configured subnets.
What's behind all this is I need an application to send a subnet
broadcast message on startup to find other instances of itself. Running
IPCONFIG from a shell is messy, and I can't find anything on MSDN.
TIA
Mike |
|
| Back to top |
|
 |
Mike Knoblock Guest
|
Posted: Thu Apr 13, 2006 1:03 am Post subject: Re: How to get the configured subnet mask for this machine? |
|
|
I looked; I swear!
Thanks!!
JF Jolin wrote:
| Quote: | 12 Apr 2006 14:41:53 -0700, Mike Knoblock <mknoblock (AT) gmail (DOT) com> wrote:
Anyone know how to use WINAPI to retrieve the subnet mask for a given
interface?
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iphlp/iphlp/getadaptersinfo.asp
I can programmatically retrieve a list of IP addresses with
gethostbyname,
but this doesn't deal with configured subnets.
What's behind all this is I need an application to send a subnet
broadcast message
on startup to find other instances of itself. Running IPCONFIG from a
shell is messy,
and I can't find anything on MSDN.
|
|
|
| Back to top |
|
 |
JF Jolin Guest
|
Posted: Thu Apr 13, 2006 1:03 am Post subject: Re: How to get the configured subnet mask for this machine? |
|
|
12 Apr 2006 14:41:53 -0700, Mike Knoblock <mknoblock (AT) gmail (DOT) com> wrote:
| Quote: | Anyone know how to use WINAPI to retrieve the subnet mask for a given interface?
|
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iphlp/iphlp/getadaptersinfo.asp
| Quote: | I can programmatically retrieve a list of IP addresses with gethostbyname,
but this doesn't deal with configured subnets.
What's behind all this is I need an application to send a subnet broadcast message
on startup to find other instances of itself. Running IPCONFIG from a shell is messy,
and I can't find anything on MSDN.
|
--
JF Jolin |
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Thu Apr 13, 2006 2:03 am Post subject: Re: How to get the configured subnet mask for this machine? |
|
|
"Mike Knoblock" <mknoblock (AT) gmail (DOT) com> wrote in message
news:443d7421$1 (AT) newsgroups (DOT) borland.com...
| Quote: | 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.
| Quote: | 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 |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|