Вопрос

Hi I am currently working on network monitoring system using SharpPcap. I am able to get the bytes from the network. But how do I convert these bytes into amount of data transfered through network, i.e. how much MB sent or MB received. I tried to look everywhere on internet but could not find a definite solution on how to do it.

Это было полезно?

Решение

Actually I got it, instead of using OnPacketArrival event I am now using OnPcapStatistics event. We get one more property in the event handling method known as Statistics and then under Statistics we get RecievedBytes. which we can compute and and keep on adding to get the total number of bytes transfered. In my original questions by Bytes I meant Bytes[] (array). Sorry to confuse you. Still I am trying to compute what is upload and download. I think the better way to compute this is via the SourceAddress, if sourceaddress is same as the machine then it is upload. Just my assumption.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top