Get the subnet mask

D

David Corticchiato

Hi,

Is there another way of getting my subnet mask without parsing
ipconfig/ifconfig ?

David.
 
J

Jan Svitok

Hi,

Is there another way of getting my subnet mask without parsing
ipconfig/ifconfig ?

David.

On linux, look somewhere in the /proc

On windows there's some WINAPI for sure, but it could be PITA to go
through all the structures. Or try WMI (through Win32OLE) -- have look
at msdn.

It depends on your needs, but parsing ipconfig is the easiest way (be
sure to take care of localisation, we had problems when we moved from
english to, say italian windows.)

You can guess the netmask from the address class, but most probably
that won't work.
 
D

Daniel Berger

David said:
Hi,

Is there another way of getting my subnet mask without parsing
ipconfig/ifconfig ?

David.

There's IPAddr#mask, from the 'ipaddr' library (part of the stdlib).
Does that help?

Regards,

Dan
 
S

Shiwei Zhang

Daniel said:
There's IPAddr#mask, from the 'ipaddr' library (part of the stdlib).
Does that help?

Regards,

Dan
IPAddr#mask can't meet this requirement I think.
If the methods for these kinds of requirements (e.g., to get Subnet
Mask, Ip Addr of the local machine) are not available for now, should we
provide them in the near future?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,983
Messages
2,570,187
Members
46,747
Latest member
jojoBizaroo

Latest Threads

Top