如何在本地连接状态下获取和发送的值 [英] how to get value received and sent in local area connection status

查看:83
本文介绍了如何在本地连接状态下获取和发送的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好我有一些关于获得价值和发送的问题在本地区域连接







我的问题是,如何使用此代码获取该值,因为很多人都把我吸引到使用  NetworkInterface []
adapters = NetworkInterface.GetAllNetworkInterfaces();



请帮帮我,我不知道接下来要做什么



和sory我的英文不好





学习编程

解决方案

您好sastro381,


您可以使用以下代码来获取接收和发送值。

 Dim performanceCounterCategory As新的PerformanceCounterCategory("网络接口")
Dim instance As String = performanceCounterCategory.GetInstanceNames()(0)
'1 1st NIC!
Dim performanceCounterSent As New PerformanceCounter(" Network Interface", "Bytes Sent / sec",instance)
Dim performanceCounterReceived As New PerformanceCounter("Network Interface","Bytes Received / sec",instance)

For i As Integer = 0至9
Console.WriteLine(发送的字节数:{0} k"& vbTab&"收到的字节数:{1} k",performanceCounterSent.NextValue()/ 1024,performanceCounterReceived.NextValue()/ 1024)
Thread.Sleep(500)
下一步

最好的问候,


Cherry



hi guys i have a some problem about getting value received and sent in local area connection


and my question is, how can i get that value using this code, because many people sugest me to use NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces();

please help me i don't know what i have to do next

and sory for my bad english


learning programming

解决方案

Hi sastro381,

You can use the following code to get receive and send value.

 Dim performanceCounterCategory As New PerformanceCounterCategory("Network Interface")
        Dim instance As String = performanceCounterCategory.GetInstanceNames()(0)
        ' 1st NIC !
        Dim performanceCounterSent As New PerformanceCounter("Network Interface", "Bytes Sent/sec", instance)
        Dim performanceCounterReceived As New PerformanceCounter("Network Interface", "Bytes Received/sec", instance)

        For i As Integer = 0 To 9
            Console.WriteLine("bytes sent: {0}k" & vbTab & "bytes received: {1}k", performanceCounterSent.NextValue() / 1024, performanceCounterReceived.NextValue() / 1024)
            Thread.Sleep(500)
        Next

Best Regards,

Cherry


这篇关于如何在本地连接状态下获取和发送的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆