Aw traffic count

From ActiveWiki
Jump to navigation Jump to search


Minimum requirements
Added in version 4.1
SDKbuild 53


int aw_traffic_count (int *traffic_in, int *traffic_out)

Description

Returns the number of bytes sent and received over a network since the last time this method was invoked.

Callback

None (returns immediately)

Notes

This method only acts on the current instance. To get the total bandwidth use in a multi-instance application it must be called for each instance.

Traffic is raw data that has been sent and received over a network. No distinction is made between compressed and uncompressed packets.

Arguments

traffic_in
Returns the number of bytes received.
traffic_out
Returns the number of bytes sent.

One or both of the pointers may be set to NULL if the return value is not desired.

Argument attributes

None

Return values

Number of bytes sent and received. All return values are 0 if the SDK has not been initialized, or if there is no current instance.

Returned attributes

None

Usage

Set the application timer depending on the total traffic. This example only works for single-instance applications.

if (aw_traffic_count (NULL, NULL) > 64)
  SetTimer (hwnd, TIMER_ID, 1, NULL);
else
  SetTimer (hwnd, TIMER_ID, 100, NULL);