Click here to Skip to main content
15,889,651 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
I Want TO Make A Network Program Which Is Intended To Such Task..


Show All Network Interface [like ethernet ,wifi] Twith there IP.

Show Active Or Disable State

if any interface is Active Then

Upload or Download bit/s

Show how many Application is currently using Internet..

And How we block to another application to Internet access..

..



Regards
Posted
Updated 10-May-22 21:03pm
v2
Comments
Sergey Alexandrovich Kryukov 8-Mar-13 15:20pm    
Not clear. What "all interface"? Active of disabled — what? What is "using"? It can be anything.
It all makes no sense.
—SA
Maciej Los 8-Mar-13 15:33pm    
Agree!
jackperl 8-Mar-13 16:20pm    
ok
jackperl 8-Mar-13 16:20pm    
Network Interfaces Like Wifi ethernet Card , and there information.. they are active or not if yes then what how much data is passing per second .
jackperl 8-Mar-13 16:22pm    
I want to know how we can read sector by sector or write sector by sector..

this can be programmed in c c++ or Python .

but is there any way to code this task in vb.net.

i need your help.

plz give your feedback.

Your gonna want to look into Cassia.Net i used this for a similar project. You can download the source code from here,

https://code.google.com/p/cassia/[^]

You going to have to play with it a bit to get incoming outgoing bytes but it works and it pretty simple.
 
Share this answer
 
VB
Private Sub getinterfaces()
        Dim nics As NetworkInterface() = NetworkInterface.GetAllNetworkInterfaces
        If nics.Length < 0 Or nics Is Nothing Then
            MsgBox("No NICS")
            Exit Sub
        End If
        IntLists.Items.Clear()

        For Each netadapter As NetworkInterface In nics
            Dim intproperties As IPInterfaceProperties = netadapter.GetIPProperties()
            IntLists.Items.Add(netadapter.Name)


        Next
    End Sub
 
Share this answer
 
Here is a function I put together. Uses WMI(W32). Pulls a lot of info for network adapters.
Usage Example - TextBox1.Text = FuncNetworkAdapter()
Microsoft documentation on it is here - Win32_NetworkAdapter class - Win32 apps | Microsoft Docs[^]
[^]
Imports System.Management has to go above the class declaration
The Imports declaration can be omitted if you go into project properties and reference. System.Management and System.Management.Instrumentation

Imports System.Management
Public Class Form1
Public Function FuncNetworkAdapter() As String
        Dim Functmp = Nothing
        FuncNetworkAdapter = Nothing
        Try
            Dim targ As String = "NetworkAdapter"
            Dim searcher As New ManagementObjectSearcher("root\CIMV2", "SELECT * FROM Win32_" & targ)
            For Each queryObj As ManagementObject In searcher.Get()
                If queryObj("AdapterType") <> Nothing Then Functmp = Functmp + "AdapterType - " + CStr(queryObj("AdapterType")) + vbCrLf
                If queryObj("AdapterTypeID") <> Nothing Then Functmp = Functmp + "AdapterTypeID - " + CStr(queryObj("AdapterTypeID")) + vbCrLf
                If queryObj("AutoSense") <> Nothing Then Functmp = Functmp + "AutoSense - " + CStr(queryObj("AutoSense")) + vbCrLf
                If queryObj("Availability") <> Nothing Then Functmp = Functmp + "Availability - " + GetNetworkAdapterAvailability(queryObj("Availability")) + vbCrLf
                If queryObj("Caption") <> Nothing Then Functmp = Functmp + "Caption - " + CStr(queryObj("Caption")) + vbCrLf
                If queryObj("ConfigManagerErrorCode") <> Nothing Then Functmp = Functmp + "ConfigManagerErrorCode - " + CStr(queryObj("ConfigManagerErrorCode")) + vbCrLf
                If queryObj("ConfigManagerUserConfig") <> Nothing Then Functmp = Functmp + "ConfigManagerUserConfig - " + CStr(queryObj("ConfigManagerUserConfig")) + vbCrLf
                If queryObj("CreationClassName") <> Nothing Then Functmp = Functmp + "CreationClassName - " + CStr(queryObj("CreationClassName")) + vbCrLf
                If queryObj("Description") <> Nothing Then Functmp = Functmp + "Description - " + CStr(queryObj("Description")) + vbCrLf
                If queryObj("DeviceID") <> Nothing Then Functmp = Functmp + "DeviceID - " + CStr(queryObj("DeviceID")) + vbCrLf
                If queryObj("ErrorCleared") <> Nothing Then Functmp = Functmp + "ErrorCleared - " + CStr(queryObj("ErrorCleared")) + vbCrLf
                If queryObj("ErrorDescription") <> Nothing Then Functmp = Functmp + "ErrorDescription - " + CStr(queryObj("ErrorDescription")) + vbCrLf
                If queryObj("GUID") <> Nothing Then Functmp = Functmp + "GUID - " + CStr(queryObj("GUID")) + vbCrLf
                If queryObj("Index") <> Nothing Then Functmp = Functmp + "Index - " + CStr(queryObj("Index")) + vbCrLf
                If queryObj("InstallDate") <> Nothing Then Functmp = Functmp + "InstallDate - " + CStr(queryObj("InstallDate")) + vbCrLf
                If queryObj("Installed") <> Nothing Then Functmp = Functmp + "Installed - " + CStr(queryObj("Installed")) + vbCrLf
                If queryObj("InterfaceIndex") <> Nothing Then Functmp = Functmp + "InterfaceIndex - " + CStr(queryObj("InterfaceIndex")) + vbCrLf
                If queryObj("LastErrorCode") <> Nothing Then Functmp = Functmp + "LastErrorCode - " + CStr(queryObj("LastErrorCode")) + vbCrLf
                If queryObj("MACAddress") <> Nothing Then Functmp = Functmp + "MACAddress - " + CStr(queryObj("MACAddress")) + vbCrLf
                If queryObj("Manufacturer") <> Nothing Then Functmp = Functmp + "Manufacturer - " + CStr(queryObj("Manufacturer")) + vbCrLf
                If queryObj("MaxNumberControlled") <> Nothing Then Functmp = Functmp + "MaxNumberControlled - " + CStr(queryObj("MaxNumberControlled")) + vbCrLf
                If queryObj("MaxSpeed") <> Nothing Then Functmp = Functmp + "MaxSpeed - " + CStr(queryObj("MaxSpeed")) + vbCrLf
                If queryObj("Name") <> Nothing Then Functmp = Functmp + "Name - " + CStr(queryObj("Name")) + vbCrLf
                If queryObj("NetConnectionID") <> Nothing Then Functmp = Functmp + "NetConnectionID - " + CStr(queryObj("NetConnectionID")) + vbCrLf
                If queryObj("NetConnectionStatus") <> Nothing Then Functmp = Functmp + "NetConnectionStatus - " + CStr(queryObj("NetConnectionStatus")) + vbCrLf
                If queryObj("NetEnabled") <> Nothing Then Functmp = Functmp + "NetEnabled - " + CStr(queryObj("NetEnabled")) + vbCrLf
                If queryObj("PermanentAddress") <> Nothing Then Functmp = Functmp + "PermanentAddress - " + CStr(queryObj("PermanentAddress")) + vbCrLf
                If queryObj("PhysicalAdapter") <> Nothing Then Functmp = Functmp + "PhysicalAdapter - " + CStr(queryObj("PhysicalAdapter")) + vbCrLf
                If queryObj("PNPDeviceID") <> Nothing Then Functmp = Functmp + "PNPDeviceID - " + CStr(queryObj("PNPDeviceID")) + vbCrLf
                If queryObj("PowerManagementSupported") <> Nothing Then Functmp = Functmp + "PowerManagementSupported - " + CStr(queryObj("PowerManagementSupported")) + vbCrLf
                If queryObj("ProductName") <> Nothing Then Functmp = Functmp + "ProductName - " + CStr(queryObj("ProductName")) + vbCrLf
                If queryObj("ServiceName") <> Nothing Then Functmp = Functmp + "ServiceName - " + CStr(queryObj("ServiceName")) + vbCrLf
                If queryObj("Speed") <> Nothing Then Functmp = Functmp + "Speed - " + CStr(queryObj("Speed")) + vbCrLf
                If queryObj("Status") <> Nothing Then Functmp = Functmp + "Status - " + CStr(queryObj("Status")) + vbCrLf
                If queryObj("StatusInfo") <> Nothing Then Functmp = Functmp + "StatusInfo - " + CStr(queryObj("StatusInfo")) + vbCrLf
                If queryObj("SystemCreationClassName") <> Nothing Then Functmp = Functmp + "SystemCreationClassName - " + CStr(queryObj("SystemCreationClassName")) + vbCrLf
                If queryObj("SystemName") <> Nothing Then Functmp = Functmp + "SystemName - " + CStr(queryObj("SystemName")) + vbCrLf
                If queryObj("TimeOfLastReset") <> Nothing Then Functmp = Functmp + "TimeOfLastReset - " + CStr(queryObj("TimeOfLastReset")) + vbCrLf
                Application.DoEvents()
                Functmp = Functmp + "----------" + vbCrLf
            Next
        Catch err As ManagementException
            MessageBox.Show("An error occurred while querying for WMI data: " & err.Message)
        End Try
        FuncNetworkAdapter = Functmp
    End Function

    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
        TextBox2.Text = FuncNetworkAdapter()
    End Sub
End Class
 
Share this answer
 
v3
Comments
EAHMK 10-Apr-24 10:28am    
Thanks for inspiring me
To pull info for network protocols installed on your machine use this one.

Public Function FuncNetworkProtocol() As String
        Dim Functmp = Nothing
        FuncNetworkProtocol = Nothing
        Try
            Dim targ As String = "NetworkProtocol"
            Dim searcher As New ManagementObjectSearcher("root\CIMV2", "SELECT * FROM Win32_" & targ)
            For Each queryObj As ManagementObject In searcher.Get()
                If queryObj("Caption") <> Nothing Then Functmp = Functmp + "Caption - " + CStr(queryObj("Caption")) + vbCrLf
                If queryObj("Description") <> Nothing Then Functmp = Functmp + "Description - " + CStr(queryObj("Description")) + vbCrLf
                If queryObj("InstallDate") <> Nothing Then Functmp = Functmp + "InstallDate - " + CStr(queryObj("InstallDate")) + vbCrLf
                If queryObj("Status") <> Nothing Then Functmp = Functmp + "Status - " + CStr(queryObj("Status")) + vbCrLf
                If queryObj("ConnectionlessService") <> Nothing Then Functmp = Functmp + "ConnectionlessService - " + CStr(queryObj("ConnectionlessService")) + vbCrLf
                If queryObj("GuaranteesDelivery") <> Nothing Then Functmp = Functmp + "GuaranteesDelivery - " + CStr(queryObj("GuaranteesDelivery")) + vbCrLf
                If queryObj("GuaranteesSequencing") <> Nothing Then Functmp = Functmp + "GuaranteesSequencing - " + CStr(queryObj("GuaranteesSequencing")) + vbCrLf
                If queryObj("MaximumAddressSize") <> Nothing Then Functmp = Functmp + "MaximumAddressSize - " + CStr(queryObj("MaximumAddressSize")) + vbCrLf
                If queryObj("MaximumMessageSize") <> Nothing Then Functmp = Functmp + "MaximumMessageSize - " + CStr(queryObj("MaximumMessageSize")) + vbCrLf
                If queryObj("MessageOriented") <> Nothing Then Functmp = Functmp + "MessageOriented - " + CStr(queryObj("MessageOriented")) + vbCrLf
                If queryObj("MinimumAddressSize") <> Nothing Then Functmp = Functmp + "MinimumAddressSize - " + CStr(queryObj("MinimumAddressSize")) + vbCrLf
                If queryObj("Name") <> Nothing Then Functmp = Functmp + "Name - " + CStr(queryObj("Name")) + vbCrLf
                If queryObj("PseudoStreamOriented") <> Nothing Then Functmp = Functmp + "PseudoStreamOriented - " + CStr(queryObj("PseudoStreamOriented")) + vbCrLf
                If queryObj("SupportsBroadcasting") <> Nothing Then Functmp = Functmp + "SupportsBroadcasting - " + CStr(queryObj("SupportsBroadcasting")) + vbCrLf
                If queryObj("SupportsConnectData") <> Nothing Then Functmp = Functmp + "SupportsConnectData - " + CStr(queryObj("SupportsConnectData")) + vbCrLf
                If queryObj("SupportsDisconnectData") <> Nothing Then Functmp = Functmp + "SupportsDisconnectData - " + CStr(queryObj("SupportsDisconnectData")) + vbCrLf
                If queryObj("SupportsEncryption") <> Nothing Then Functmp = Functmp + "SupportsEncryption - " + CStr(queryObj("SupportsEncryption")) + vbCrLf
                If queryObj("SupportsExpeditedData") <> Nothing Then Functmp = Functmp + "SupportsExpeditedData - " + CStr(queryObj("SupportsExpeditedData")) + vbCrLf
                If queryObj("SupportsFragmentation") <> Nothing Then Functmp = Functmp + "SupportsFragmentation - " + CStr(queryObj("SupportsFragmentation")) + vbCrLf
                If queryObj("SupportsGracefulClosing") <> Nothing Then Functmp = Functmp + "SupportsGracefulClosing - " + CStr(queryObj("SupportsGracefulClosing")) + vbCrLf
                If queryObj("SupportsGuaranteedBandwidth") <> Nothing Then Functmp = Functmp + "SupportsGuaranteedBandwidth - " + CStr(queryObj("SupportsGuaranteedBandwidth")) + vbCrLf
                If queryObj("SupportsMulticasting") <> Nothing Then Functmp = Functmp + "SupportsMulticasting - " + CStr(queryObj("SupportsMulticasting")) + vbCrLf
                If queryObj("SupportsQualityofService") <> Nothing Then Functmp = Functmp + "SupportsQualityofService - " + CStr(queryObj("SupportsQualityofService")) + vbCrLf
                Application.DoEvents()
                Functmp = Functmp + "----------" + vbCrLf
            Next
        Catch err As ManagementException
            MessageBox.Show("An error occurred while querying for WMI data: " & err.Message)
        End Try
        FuncNetworkProtocol = Functmp
    End Function
 
Share this answer
 
For active Network Connections use this one

Public Function FuncNetworkConnection() As String
Dim Functmp = Nothing
FuncNetworkConnection = Nothing
Try
Dim targ As String = "NetworkConnection"
Dim searcher As New ManagementObjectSearcher("root\CIMV2", "SELECT * FROM Win32_"& targ)
For Each queryObj As ManagementObject In searcher.Get()
If queryObj("Caption") <> Nothing Then Functmp = Functmp + "Caption - " + CStr(queryObj("Caption")) + vbCrLf
If queryObj("Description") <> Nothing Then Functmp = Functmp + "Description - " + CStr(queryObj("Description")) + vbCrLf
If queryObj("InstallDate") <> Nothing Then Functmp = Functmp + "InstallDate - " + CStr(queryObj("InstallDate")) + vbCrLf
If queryObj("Status") <> Nothing Then Functmp = Functmp + "Status - " + CStr(queryObj("Status")) + vbCrLf
If queryObj("AccessMask") <> Nothing Then Functmp = Functmp + "AccessMask - " + CStr(queryObj("AccessMask")) + vbCrLf
If queryObj("Comment") <> Nothing Then Functmp = Functmp + "Comment - " + CStr(queryObj("Comment")) + vbCrLf
If queryObj("ConnectionState") <> Nothing Then Functmp = Functmp + "ConnectionState - " + CStr(queryObj("ConnectionState")) + vbCrLf
If queryObj("ConnectionType") <> Nothing Then Functmp = Functmp + "ConnectionType - " + CStr(queryObj("ConnectionType")) + vbCrLf
If queryObj("DisplayType") <> Nothing Then Functmp = Functmp + "DisplayType - " + CStr(queryObj("DisplayType")) + vbCrLf
If queryObj("LocalName") <> Nothing Then Functmp = Functmp + "LocalName - " + CStr(queryObj("LocalName")) + vbCrLf
If queryObj("Name") <> Nothing Then Functmp = Functmp + "Name - " + CStr(queryObj("Name")) + vbCrLf
If queryObj("Persistent") <> Nothing Then Functmp = Functmp + "Persistent - " + CStr(queryObj("Persistent")) + vbCrLf
If queryObj("ProviderName") <> Nothing Then Functmp = Functmp + "ProviderName - " + CStr(queryObj("ProviderName")) + vbCrLf
If queryObj("RemoteName") <> Nothing Then Functmp = Functmp + "RemoteName - " + CStr(queryObj("RemoteName")) + vbCrLf
If queryObj("RemotePath") <> Nothing Then Functmp = Functmp + "RemotePath - " + CStr(queryObj("RemotePath")) + vbCrLf
If queryObj("ResourceType") <> Nothing Then Functmp = Functmp + "ResourceType - " + CStr(queryObj("ResourceType")) + vbCrLf
If queryObj("UserName") <> Nothing Then Functmp = Functmp + "UserName - " + CStr(queryObj("UserName")) + vbCrLf
Application.DoEvents()
Functmp = Functmp + "----------" + vbCrLf
Next
Catch err As ManagementException
MessageBox.Show("An error occurred while querying for WMI data: " & err.Message)
End Try
FuncNetworkConnection = Functmp
End Function
 
Share this answer
 
Comments
CHill60 11-May-22 7:51am    
You've posted 3 different solutions to this 9 year old question. At best this is confusing, at worst it looks like "reputation point hunting"
If you need to add information to your original solution then use the "Improve solution" link next to it - I strongly advise you to do that and then delete Solutions 4 and 5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900