Results 1 to 6 of 6

Thread: how to get active network connection name

  1. #1

    Thread Starter
    Fanatic Member coolcurrent4u's Avatar
    Join Date
    Apr 2008
    Location
    *****
    Posts
    991

    Cool 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
    Programming is all about good logic. Spend more time here


    (Generate pronounceable password) (Generate random number c#) (Filter array with another array)

  2. #2
    Fanatic Member
    Join Date
    Jul 2009
    Posts
    629

    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.

  3. #3

    Thread Starter
    Fanatic Member coolcurrent4u's Avatar
    Join Date
    Apr 2008
    Location
    *****
    Posts
    991

    Re: how to get active network connection name

    thanks, but this is getting ip addresses instead
    Programming is all about good logic. Spend more time here


    (Generate pronounceable password) (Generate random number c#) (Filter array with another array)

  4. #4
    Addicted Member
    Join Date
    Apr 2011
    Posts
    223

    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

  5. #5

    Thread Starter
    Fanatic Member coolcurrent4u's Avatar
    Join Date
    Apr 2008
    Location
    *****
    Posts
    991

    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
    Programming is all about good logic. Spend more time here


    (Generate pronounceable password) (Generate random number c#) (Filter array with another array)

  6. #6
    Addicted Member
    Join Date
    Apr 2011
    Posts
    223

    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
  •  



Click Here to Expand Forum to Full Width