c# - Getting per connection bandwidth statistics -
i need determine per-process network usage statistics similar tcpview can do.
example http://img513.imageshack.us/img513/861/6601f15814544055a590e26.png
so before shoot me posting duplicate of this question, or this question, point out neither of have thorough answer me this.
i've been doing research, , there many ways list out active connections , associated processes, whether netstat or other windows api's iphlpapi.dll.
now, google'ing i've done, have not found - except these vague terms: getpertcpconnectionestats , getpertcp6connectionestats. presumably tcp on ipv4 , ipv6 respectively. reading supposedly able need do. however, still leaves out udp. , not available on xp systems, tcpviewer works on.
i satisfied using tcp, problem is, can't seem find examples of how use them c#.
so guess boils down these few questions:
- does know how tcpview it?
- how use getpertcpconnectionestats tcp? or can accomplish i'm suggesting?
- is there known alternative work udp?
the whole point of see independent bandwidth usage of processes themselves. not calculate total system bandwidth usage.
thanks in advance , answers.
i spent bit of time trying figure out how i'd similar (latency vs bandwidth) have had give due lack of time invest. thought i'd add findings here in hope answer.
you'll need use pinvoke , i'm afraid specifics far beyond experience it.
this wrapper library on codeproject uses allocateandgettcpextablefromstack works on windows xp , server 2003. still doesn't bandwidth though sorry.
the closest information find starting point (for vista/server 2008 or newer) example on pinvoke.net getextendedtcptable.
the tool pinvoke interop assistant might determine how call unmanaged code.
if keep trying i'd try figure out following:
- how call setpertcpconnectionestats enable collection of tcpconnectionestatsbandwidth via appropriate tcp_estats_type.
- i'd use ipglobalproperties.getactivetcpconnections information needed create mib_tcprow.
- determine how call getpertcpconnectionestats monitor data.
Comments
Post a Comment