bytes sent and received from network adapter

  • Thread starter Thread starter Ricardo
  • Start date Start date
R

Ricardo

Can anyone help me to get the information given if you open the status
box of your internet connection? It gives connection speed, duration, bytes
sent, and bytes received.Is there some way to read this information from
performancelog?thankyou
 
I believe this is acquired from RASAPI.

The method is RasGetConnectionStatistics ...

[DllImport("rasapi32.dll", CharSet=CharSet.Auto, SetLastError=true)]
static extern uint RasGetConnectionStatistics(IntPtr hRasConn, ref RAS_STATS
lpStatistics);

[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
struct RAS_STATS
{
public int dwSize;
public int dwBytesXmited;
public int dwBytesRcved;
public int dwFramesXmited;
public int dwFramesRcved;
public int dwCrcErr;
public int dwTimeoutErr;
public int dwAlignmentErr;
public int dwHardwareOverrunErr;
public int dwFramingErr;
public int dwBufferOverrunErr;
public int dwCompressionRatioIn;
public int dwCompressionRatioOut;
public int dwBps;
public int dwConnectionDuration;
}


http://www.codeproject.com/aspnet/webdialup.asp includes a wrapper for this
functionality ...

Cheers,

Greg Young

And I got my blog post for the day ... been a while since I played with
RasAPI :)
 
Thanks a lot Greg!!!

Is there a way to get this measures when you´re broadband connected??
Over PPPoE connection for example?

thanks again


Greg Young said:
I believe this is acquired from RASAPI.

The method is RasGetConnectionStatistics ...

[DllImport("rasapi32.dll", CharSet=CharSet.Auto, SetLastError=true)]
static extern uint RasGetConnectionStatistics(IntPtr hRasConn, ref
RAS_STATS lpStatistics);

[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
struct RAS_STATS
{
public int dwSize;
public int dwBytesXmited;
public int dwBytesRcved;
public int dwFramesXmited;
public int dwFramesRcved;
public int dwCrcErr;
public int dwTimeoutErr;
public int dwAlignmentErr;
public int dwHardwareOverrunErr;
public int dwFramingErr;
public int dwBufferOverrunErr;
public int dwCompressionRatioIn;
public int dwCompressionRatioOut;
public int dwBps;
public int dwConnectionDuration;
}


http://www.codeproject.com/aspnet/webdialup.asp includes a wrapper for
this functionality ...

Cheers,

Greg Young

And I got my blog post for the day ... been a while since I played with
RasAPI :)







Ricardo said:
Can anyone help me to get the information given if you open the status
box of your internet connection? It gives connection speed, duration,
bytes sent, and bytes received.Is there some way to read this information
from performancelog?thankyou
 
It works with any windows connection (dial up, VPN, etc)

Cheers,

Greg
Ricardo said:
Thanks a lot Greg!!!

Is there a way to get this measures when you´re broadband connected??
Over PPPoE connection for example?

thanks again


Greg Young said:
I believe this is acquired from RASAPI.

The method is RasGetConnectionStatistics ...

[DllImport("rasapi32.dll", CharSet=CharSet.Auto, SetLastError=true)]
static extern uint RasGetConnectionStatistics(IntPtr hRasConn, ref
RAS_STATS lpStatistics);

[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
struct RAS_STATS
{
public int dwSize;
public int dwBytesXmited;
public int dwBytesRcved;
public int dwFramesXmited;
public int dwFramesRcved;
public int dwCrcErr;
public int dwTimeoutErr;
public int dwAlignmentErr;
public int dwHardwareOverrunErr;
public int dwFramingErr;
public int dwBufferOverrunErr;
public int dwCompressionRatioIn;
public int dwCompressionRatioOut;
public int dwBps;
public int dwConnectionDuration;
}


http://www.codeproject.com/aspnet/webdialup.asp includes a wrapper for
this functionality ...

Cheers,

Greg Young

And I got my blog post for the day ... been a while since I played with
RasAPI :)







Ricardo said:
Can anyone help me to get the information given if you open the status
box of your internet connection? It gives connection speed, duration,
bytes sent, and bytes received.Is there some way to read this
information from performancelog?thankyou
 
Back
Top