> I know the question seems obvious. One way would be creting a critical
> section protected variable in the server listener thread and add every
> packet sent and check and reset every second, right? But let's
> consider we have 1000 clients downloading. Each second the critical
> section would be acquired and released at least 2000 times! I believe
> it would create a bottlenect just for the sake of drawing a chart of
> bandwidth transferred! What other method would you suggest?

Use InterlockedExchangeAdd API function. It is a hardware assisted API and 
is the fastest possible.
Another solution is to count each client individually and do the sum only 
when needed.

--
Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
http://www.overbyte.be


-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to