Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Sep : Re: How can i get the ip's NetWork Mask

www.cryer.info
Managed Newsgroup Archive

Re: How can i get the ip's NetWork Mask

Subject:Re: How can i get the ip's NetWork Mask
Posted by:"Angus Johnson" (angu..@undisclosed.loc)
Date:Fri, 22 Sep 2006 19:53:42

> Is your code running on the server machine to begin with?  If so, then
> look
> at the Win32 API GetAdaptersInfo() function.  It can return the IP and
> Subnet for every network adapter on the machine.
>
> Otherwise, there is no way to obtain a mask from an IP alone.

That's not quite true. You can also get the an adapter's netmask via SNMP
The relevant OID is .1.3.6.1.2.1.4.20.1.3
see SnmpExtensionQuery() and related functions (even works on machines which
don't support GetAdaptersInfo ).

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive