Board index » Visual Studio » Internet connection speed and bytes sent/received

Internet connection speed and bytes sent/received

Visual Studio52
Need some code to obtain data straight from Windows such as Connection

Speed, and the number of bytes sent/received. I have seen amateur code

in various VB Code websites and is not really what I'm after. I really

need one that grabs the data from Windows when I click on a button, even

if I have already been connected for, say, 2 hours. **You know the data

that pops up when you hover your mouse over the 2 terminals in the

System Tray? Well I somehow need to grab those figures so they can be

implemented into my program**. Any ideas? I haven't seen any code that

does this... The figures need to be rather accurate.



Regards,

Jason





*** Sent via Developersdex www.developersdex.com ***

Don't just participate in USENET...get rewarded for it!


-
 

Re:Internet connection speed and bytes sent/received

On Fri, 21 May 2004 06:22:28 -0700, Jason S <jason3712@iprimus.com.au>

wrote:



Quote
Need some code to obtain data straight from Windows such as Connection

Speed, and the number of bytes sent/received. I have seen amateur code

in various VB Code websites and is not really what I'm after. I really

need one that grabs the data from Windows when I click on a button, even

if I have already been connected for, say, 2 hours. **You know the data

that pops up when you hover your mouse over the 2 terminals in the

System Tray? Well I somehow need to grab those figures so they can be

implemented into my program**. Any ideas? I haven't seen any code that

does this... The figures need to be rather accurate.



All this type of information is held by RAS.



I've never had cause to use the function so I can't give you an

example but it would appear that the API you need is

MprAdminConnectionGetInfo.



This will return either a RAS_CONNECTION_0 structure or a

RAS_CONNECTION_1 structure, for a given RAS Connection.



The first structure includes the current duration of the connection

and the second includes the bytes transmitted and received so far on

the connection.



If you don't have a handle to the connection then you'll need to use

RasEnumConnections to get one.



Have a read in MSDN.



Gale.



-