
i want my c# program to be able to display the online duration of the network device. i have tried NetworkInterface class but it does not have that info.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Try getting it through RAS (Remote Access Service), by using DotRas (http://dotras.codeplex.com/), that “Provides remote access service (RAS) components for .NET languages like C#, VB.NET, and C++ CLR projects” as stated on the website.
By checking the function RasGetConnectionStatistics (MSDN documentation) I’ve found it returns a structure (RAS_STATS) that has the field “dwConnectDuration” in it.
Hopefully DotRas will provide you a easy way to access that function in C#, along with all the data it returns.
References:
http://bytes.com/topic/net/answers/484607-bytes-sent-received-network-adapter
http://channel9.msdn.com/forums/TechOff/69065-Creating-a-RAS-connection-with-C/