2013-03-12 75 views
2

有什么方法可以使用性能计数器来监视所有流量,但是在特定的端口?使用性能计数器监视特定端口

我做:

GetCounterValue(_netRecvCounters[index], "Network Interface", "Bytes Received/sec", _instanceNames[index]): 

double GetCounterValue(PerformanceCounter pc, string categoryName, string counterName, string instanceName) 
    { 
     pc.CategoryName = categoryName; 
     pc.CounterName = counterName; 
     pc.InstanceName = instanceName; 
     return pc.NextValue(); 
    } 

但似乎一切都记录

回答

0

随着性能计数器,总要有人明确规定每个计数器值添加到注册表。如果没有人提供你正在寻找的具体价值作为输入,那么就没有办法把它拿出来。

+0

我该怎么做,没有性能计数器?有没有其他方法? – 2013-03-12 21:14:31