BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How can i get the ip's NetWork Mask

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock
View previous topic :: View next topic  
Author Message
juan
Guest





PostPosted: Thu Sep 21, 2006 11:23 pm    Post subject: How can i get the ip's NetWork Mask Reply with quote



Hi all,
I need obtain the netmask of the server's ip. How can do that?
Thanks.
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Thu Sep 21, 2006 11:58 pm    Post subject: Re: How can i get the ip's NetWork Mask Reply with quote



"juan" <nosapm (AT) nospam (DOT) com> wrote in message
news:4512d971 (AT) newsgroups (DOT) borland.com...

Quote:
I need obtain the netmask of the server's ip. How can do that?

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.


Gambit
Back to top
Angus Johnson
Guest





PostPosted: Fri Sep 22, 2006 2:53 pm    Post subject: Re: How can i get the ip's NetWork Mask Reply with quote



Quote:
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 ).
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Fri Sep 22, 2006 10:22 pm    Post subject: Re: How can i get the ip's NetWork Mask Reply with quote

"Angus Johnson" <angusj (AT) undisclosed (DOT) loc> wrote in message
news:4513b2a6$1 (AT) newsgroups (DOT) borland.com...

Quote:
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

I assume that you are referring to querying a netowkr server, such as a
router?

Quote:
even works on machines which don't support GetAdaptersInfo.

All Windows machines going back to Windows 98 support GetAdaptersInfo()


Gambit
Back to top
Angus Johnson
Guest





PostPosted: Sat Sep 23, 2006 3:57 am    Post subject: Re: How can i get the ip's NetWork Mask Reply with quote

Quote:
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

I assume that you are referring to querying a netowkr server, such as a
router?

The beauty of SNMP is you can use it to query both local and remote devices
(including routers).
My understanding of GetAdaptersInfo is that it only works for the local PC.

Quote:
even works on machines which don't support GetAdaptersInfo.

All Windows machines going back to Windows 98 support GetAdaptersInfo()

In my experience the required IpHlpApi.dll isn't as ubiquitous as you're
suggesting.
WinNT4 machines come to mind as one OS where it isn't found.

And from MSDN:
GetAdaptersInfo requires
Windows Vista, Windows XP, Windows 2000 Professional, Windows Me, or Windows
98.
SnmpExtensionQuery and related functions require
Requires Windows Vista, Windows XP, Windows 2000 Professional, Windows NT
Workstation, Windows Me, Windows 98, or Windows 95.

Anyhow, if the OP or others are looking for Delphi SNMP Api functions, they
can be downloaded as part of JCL: http://sourceforge.net/projects/jcl/
Back to top
Mervin Pearce [SACS]
Guest





PostPosted: Fri Sep 29, 2006 1:04 am    Post subject: Re: How can i get the ip's NetWork Mask Reply with quote

And if you are in a secured environment, SNMP will be disabled. You can
also get the netmask using a return value from a PING request, once again
FW may drop this.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.