-
Jun 28th, 2011, 11:44 AM
#1
Thread Starter
Fanatic Member
how to get active network connection name
Hello,
can anybody help me with code snippet to get active network card name, that is the network card currently connected to the internet in c# or vb.net?
thanks
-
Jun 28th, 2011, 12:02 PM
#2
Fanatic Member
Re: how to get active network connection name
Not sure if this helps:
Code:
Public Shared ReadOnly Property CurrentIPs() As String()
Get
Dim ips As New List(Of String)
Dim addresses() As Net.IPAddress = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName).AddressList
For i As Integer = addresses.Count / 2 To addresses.Count - 1
ips.Add(addresses(i).ToString)
Next
Return ips.ToArray
End Get
End Property
Look for functions under System.Net and/or System.Net.Dns for some network information.
-
Jun 29th, 2011, 04:06 AM
#3
Thread Starter
Fanatic Member
Re: how to get active network connection name
thanks, but this is getting ip addresses instead
-
Jun 29th, 2011, 06:30 AM
#4
Addicted Member
Re: how to get active network connection name
This thread sounds largely what you are asking. The catch is it will retrieve the names, but not select the "active" one as you mention.
http://www.vbforums.com/showthread.php?t=653237
-
Jun 29th, 2011, 08:18 AM
#5
Thread Starter
Fanatic Member
Re: how to get active network connection name
no you are getting me wrong, am trying to get the name of the currently active network card connected to internet, there might be more than one card in the system
-
Jun 29th, 2011, 05:07 PM
#6
Addicted Member
Re: how to get active network connection name
Okay, then spend a bit more time in the search feature of the forums. This does contain the actual adapter names, but you will have to do a little weed-wacking to get it exactly how you want.
http://www.vbforums.com/showthread.p...dapter+network
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|