Is there any definite range for index of an network adapter?
-
Each network adapter has an ip address,subnet mask attached with it,right?Similarly,an network adapter also has an index associated with it,through which we can bind a scoket to it.the ethernet adapter that i have has index 2.so,i am asking whether there is some range for index of an network adapter?
OK. The range you're talking about is technically 0 to Int32.Max. Though, system resources limits that to probably a few thousand adapters.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
OK. The range you're talking about is technically 0 to Int32.Max. Though, system resources limits that to probably a few thousand adapters.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008I didn't get your answer.see i have to develope an application in which i have to distinguish out of the network adapter cards available in the system,which one is ethernet and which one is wireless.Its easy to know which one is ethernet but for wireless i am not getting anything.But one think that I have noticed is index number for ethernet is genearlly 2,3etc and for wireless its 65530 etc.I was thinking to distinguish both referring to the index number.I hope u now understand what my problem is.Pls help if u have any answer to it.Thanks...
-
I didn't get your answer.see i have to develope an application in which i have to distinguish out of the network adapter cards available in the system,which one is ethernet and which one is wireless.Its easy to know which one is ethernet but for wireless i am not getting anything.But one think that I have noticed is index number for ethernet is genearlly 2,3etc and for wireless its 65530 etc.I was thinking to distinguish both referring to the index number.I hope u now understand what my problem is.Pls help if u have any answer to it.Thanks...
an89 wrote:
number for ethernet is genearlly 2,3etc and for wireless its 65530
That's the wrong way to go about it. You have to query each adapter to get it's type. You don't say what you're using to get the adapters list. I'll suggest using WMI to make it real easy to tell the difference. Check out the Win32_NetworkAdapter[^] class.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
an89 wrote:
number for ethernet is genearlly 2,3etc and for wireless its 65530
That's the wrong way to go about it. You have to query each adapter to get it's type. You don't say what you're using to get the adapters list. I'll suggest using WMI to make it real easy to tell the difference. Check out the Win32_NetworkAdapter[^] class.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008I have used GetAdapterAddress and GetAdapterInfo which are part of win32 API to get list of interfaces.But the problem is that for ethernet everything is showing fine.But for wireless adapter the type it is returning is "ethernet".But it is returning all other information correctly about the wireless adapter such as ipaddress,index and name.I don't know why its happening.and I can't use WMI.
-
I have used GetAdapterAddress and GetAdapterInfo which are part of win32 API to get list of interfaces.But the problem is that for ethernet everything is showing fine.But for wireless adapter the type it is returning is "ethernet".But it is returning all other information correctly about the wireless adapter such as ipaddress,index and name.I don't know why its happening.and I can't use WMI.
OK. Look at Interfaces, not Adapters. You can get the media type (IEEE802.11 - Radio Spread Spectrum) from the Interfaces table. Check into the GetIf* functions instead.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
OK. Look at Interfaces, not Adapters. You can get the media type (IEEE802.11 - Radio Spread Spectrum) from the Interfaces table. Check into the GetIf* functions instead.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
I didn't get you.Could you please give me some links or some source code so as to understand what you have specified.Thanks....
GetIfTable[^] If you look at the left side, you'll see all the GetIf* functions.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
GetIfTable[^] If you look at the left side, you'll see all the GetIf* functions.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
Thanks for your help but It didn't help either.The function displays type of wireless as ethernet.If you know any other method pls do reply.
Yes, it does tell you. That's the only method besides WMI to get what you want. The Type should have come back as IEEE802.11. If it didn't, then it's the fault of the driver for your adapter.
dwType
can currently come back with 144 different interface types.A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
Yes, it does tell you. That's the only method besides WMI to get what you want. The Type should have come back as IEEE802.11. If it didn't, then it's the fault of the driver for your adapter.
dwType
can currently come back with 144 different interface types.A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
no the type came as "ethernet".In Linux also the type for wireless adapter comes as "ethernet" when you give ifconfig.U can try it also.
I don't care, because I use WMI to do this stuff and it's not lying to me. I already told you that this is the ONLY way to get the data you want, save for using WMI, which you "can't use". There is no other option. If it lies to you, there's nothing you can do about it. Well, other than see if the manufacturer of your wireless adapter has updated drivers, because that's where this data is coming from.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
I don't care, because I use WMI to do this stuff and it's not lying to me. I already told you that this is the ONLY way to get the data you want, save for using WMI, which you "can't use". There is no other option. If it lies to you, there's nothing you can do about it. Well, other than see if the manufacturer of your wireless adapter has updated drivers, because that's where this data is coming from.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
I have no idea. I'm not going to repeat the bottom line for a third time.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008