Thread View: borland.public.cppbuilder.internet.socket
4 messages
4 total messages
Started by Mike Knoblock
Wed, 12 Apr 2006 21:41
How to get the configured subnet mask for this machine?
Author: Mike Knoblock
Date: Wed, 12 Apr 2006 21:41
Date: Wed, 12 Apr 2006 21:41
11 lines
1300 bytes
1300 bytes
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
Re: How to get the configured subnet mask for this machine?
Author: JF Jolin
Date: Wed, 12 Apr 2006 23:03
Date: Wed, 12 Apr 2006 23:03
16 lines
1498 bytes
1498 bytes
12 Apr 2006 14:41:53 -0700, Mike Knoblock <mknoblock@gmail.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. -- JF Jolin
Re: How to get the configured subnet mask for this machine?
Author: Mike Knoblock
Date: Wed, 12 Apr 2006 23:13
Date: Wed, 12 Apr 2006 23:13
25 lines
1666 bytes
1666 bytes
I looked; I swear! Thanks!! JF Jolin wrote: > 12 Apr 2006 14:41:53 -0700, Mike Knoblock <mknoblock@gmail.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. > >
Re: How to get the configured subnet mask for this machine?
Author: Remy Lebeau (TeamB)
Date: Thu, 13 Apr 2006 00:59
Date: Thu, 13 Apr 2006 00:59
23 lines
1624 bytes
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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads