?
Solved

How to get all active connections (TCP or UDP) & traffic (bytesin and bytes out) in c#

Posted on 2011-10-20
6
Medium Priority
?
1,719 Views
Last Modified: 2013-12-23
How can i get all active connections (TCP or UDP) and traffic traffic (bytesin and bytes out) in c#
i find a functions in the internet to get active connection if it either tcp or udp but can't find the traffic size on each connection like download or upload size (bytesin and bytes out)..
i want them like comodo firewall
How can i get them ???

Help me please
0
Comment
Question by:hintco
  • 3
  • 3
6 Comments
 
LVL 38

Expert Comment

by:Rich Rumble
ID: 37004417
You'd probably be better off using a library that is already suited for this, Win-PCAP or M$'s Netmon
http://www.i-programmer.info/projects/27-networking/720-using-microsoft-network-monitor-33.html
I don't program but I use a lot of sniffing software and these are the libraries and tools used most often.
I'm not as familiar with the Netmon as the pcap, and this seems to be framework for .Net:
http://www.codeproject.com/KB/IP/sharppcap.aspx
-rich
0
 
LVL 38

Expert Comment

by:Rich Rumble
ID: 37004459
Also you can use WMI to get total's, like for the entire day, but remember they do roll over at some point so you need to figure out how to keep counting when this happens.
Namespace -> Root\cimv2  Class -> Win32_PerfFormattedData_Tcpip_IPv4
Has some interesting data in it, as do: Win32_PerfFormattedData_Tcpip_TCPv4
Win32_PerfFormattedData_Tcpip_TCPv4, Win32_PerfRawData_Tcpip_TCPv4,
http://include.wutils.com/wmi/ROOT%5Ccimv2/CIM_StatisticalInformation/Win32_Perf/Win32_PerfRawData/Win32_PerfRawData_Tcpip_TCPv4/cs-samples.html
SNMP counters can be used as well, but you have to install SNMP (typically not default, but can be added to the OS easily using control panel[add/remove->windows components)
-rich
0
 
LVL 1

Author Comment

by:hintco
ID: 37016822
I want the active connections with Traffic - bytes in (download) & bytes Out (Upload) - as  shown in comodo exactly
i will attach you image to know what i mean..

Comodo Active Connections
0
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
LVL 38

Expert Comment

by:Rich Rumble
ID: 37017205
I understand, there are libraries to help you do that... I don't program so I don't know how to show you, but I know these libraries will allow you to do what you want, perhaps visit their websites/forums to get further advice.
-rich
0
 
LVL 1

Accepted Solution

by:
hintco earned 0 total points
ID: 37023418
I try the libraries you mentioned above but the result not exactly what i want to do
Please help.
0
 
LVL 1

Author Closing Comment

by:hintco
ID: 37335607
There isn't any other solution until now
i give up and closed the question
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
Measuring Server's processing rate with a simple powershell command. The differences in processing rate also was recorded in different use-cases, when a server in free and busy states.
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question