473,586 Members | 2,707 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

detecting enabled network interfaces in win32

In one of my "because I can" projects, I want to be able to see the
enabled network interfaces on a machine. I have no clue as to how to
do this. Any suggestions?
Jul 18 '05 #1
4 3612
In one of my "because I can" projects, I want to be able to see the
enabled network interfaces on a machine. I have no clue as to how to
do this. Any suggestions?


Parse the output of 'ipconfig /all' on NT/2k/XP/2k3 machines.
I'm sure it is available in the registry, I've been there before, but I
can't remember the key name. Use regedit to find the key with your
network interface to determine where you should be polling in general.
- Josiah

Jul 18 '05 #2
ma**********@gm ail.com (Matthew K Jensen) wrote in message news:<a8******* *************** ****@posting.go ogle.com>...
In one of my "because I can" projects, I want to be able to see the
enabled network interfaces on a machine. I have no clue as to how to
do this. Any suggestions?


Use the WSAIoctl function of Winsock2 with the command (2nd parameter)
dwIoControlCode = SIO_GET_INTERFA CE_LIST.

The other key important tidbit of information would be that you will
need to pass the address of an array of INTERFACE_INFO structures to
the output buffer (5th parameter - lpvOutBuffer) to obtain structures
containing the information you desire.

Below are links to the MSDN documentation of both the WSAIoctl
function and the INTERFACE_INFO structure.

Documentation for WSAIoctl:
http://msdn.microsoft.com/library/de...wsaioctl_2.asp
Documentation for INTERFACE_INFO:
http://msdn.microsoft.com/library/de...ace_info_2.asp

I don't that this function is exposed through any of the win32 python
extensions, although I have not had time to research this in order to
be sure.

For that reason, you would likely have to access this method using
ctypes.

Enjoy, and please let me know when you've written such a script
because I'd love to use it. =)

Michael Loritsch
Jul 18 '05 #3
If you have pywin32 installed, you can get the info thru WMI:

import win32com.client
wmi=win32com.cl ient.GetObject( 'winmgmts:')
adapters=wmi.In stancesOf('win3 2_networkadapte r')
for adapter in adapters:
for p in adapter.Propert ies_:
print p.Name, p.Value

hth
Roger

"Matthew K Jensen" <ma**********@g mail.com> wrote in message
news:a8******** *************** ***@posting.goo gle.com...
In one of my "because I can" projects, I want to be able to see the
enabled network interfaces on a machine. I have no clue as to how to
do this. Any suggestions?

Jul 18 '05 #4
ma**********@gm ail.com (Matthew K Jensen) wrote in message news:<a8******* *************** ****@posting.go ogle.com>...
In one of my "because I can" projects, I want to be able to see the
enabled network interfaces on a machine. I have no clue as to how to
do this. Any suggestions?


Try this:

http://tgolden.sc.sabren.com/python/...l#ip_addresses

TJG
Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
1900
by: SenderX | last post by:
I am a basically a life-long Win32 C programmer specializing in high-end winsock servers. Before I dive into portable C++ programming, I wanted to code up an example of what I thought would be a workable Collection template library. The idea is to design API's that operate on interfaces, and provide multi-implementations to that "single"...
5
3701
by: Rich | last post by:
I have a simple, single threaded program in C++ that runs as Idle priority. The program creates some data which needs dumping to file if the computer is shutdown or logged out. At the moment there is almost no Win32 code in it (only a few lines to do the idle priority class). What is the simplest way of programatically detecting the...
25
2885
by: Ryan Stewart | last post by:
I'm working on a project to collect web application usage statistics. What are the recommended ways of detecting whether a browser is JavaScript enabled and/or capable? Obviously I can write a script to invoke something on the server, and if it works, then it works. Is there a better way? I'm looking for the least intrusive way of doing it,...
7
2409
by: wij | last post by:
Hi: Is there better way of detecting multiplication overflow for type long than by using double precision of lldiv to verify the result? Thanks in advance. I.J.Wang
3
11259
by: Scott Leonard | last post by:
Hello - I'm writing an application that will be used on "sometimes connected" devices (laptops, tablets). In C#, what is the best way to detect whether a network connection is present? I'd rather not rely on a network request timing out - the detection process must be very quick. Thanks in advance,
1
18338
by: Daniel Diehl | last post by:
Hi, I'm looking for a solution to detect if a USB Sticker (USB Drive) ist plugged in or plugged out. Currently Im able to detect Hardware Plugin and Plugout but don't get any information what type of device it is. Is there a way to get this information ? Currenty my solution work in that way (Also from this group): protected override void...
17
6404
by: OlafMeding | last post by:
Below are 2 files that isolate the problem. Note, both programs hang (stop responding) with hyper-threading turned on (a BIOS setting), but work as expected with hyper-threading turned off. Note, the Windows task manager shows 2 CPUs on the Performance tab with hyper-threading is turned on. Both Python 2.3.5 and 2.4.3 (downloaded from...
15
4212
by: RobG | last post by:
When using createEvent, an eventType parameter must be provided as an argument. This can be one of those specified in DOM 2 or 3 Events, or it might be a proprietary eventType. My problem is testing for support of particular eventTypes - the DOM 2 Events Interface DocumentEvent says that if the eventType is not supported, it throws a DOM...
12
2787
by: Anic297 | last post by:
Hi, This is certainly a simple question, but I'm a newbie in JavaScript. Is there a way to know if JavaScript is enabled? My php script uses JavasSript to do something. If JavaScript is not enabled, I can put a "submit" push button. But I don't want both (the "submit" push button with the automatic action), so I want to know on the fly...
0
7912
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8202
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8338
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8216
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5710
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1449
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.