views:

897

answers:

3

I would like to be able to measure network traffic and limit it.

I'm looking for something that lets me know between two calls how much data has been sent and received. Also, I would like to be able to limit network traffic (in & out) for my app. Something like the NetLimiter software (great app!) but which I can control from my code.

Do you know some third party components to do this ?

This is meant to be used on a datasnap 2009 thin-client.

+1  A: 

Have you seen this question? Might not be exactly what you're looking for, but it looks similar...

Mason Wheeler
yep, i've seen it, but what i'm looking for is a more generic way to do it. I don't know if i would be able to do it even if datasnap is based on indy. Moreover, it's not about limiting traffic, just logging it
Fred
Right, but it could get you started off in the right direction...
Mason Wheeler
...and you could easily limit the traffic by just not calling the inherited Send and Receive functions if the traffic limit is hit.
Smasher
That doesn't limit the traffic, Smasher. That discards it entirely. You can't not call the inherited methods. Throttling involves sending the same data, just not as quickly.
Rob Kennedy
Oops, I'm sorry, that's true of course. My approach is kind of a stupid way to limit the traffic ;)
Smasher
+2  A: 

If you use Indy, then use the TIdInterceptThrottler class. Simply set the BitsPerSec property.

My understanding is that DataSnap is based on Indy.

Rob Kennedy
Thanks for your reply, i've take a look at what you said. From what i understand, datasnap is based on Indy on the server side, and on dbexpress on the client side. So, i think that it should be possible to limit/monitor traffic but only on the server. (but that don't seems to be so straightforward)
Fred
Sorry, that's the best I can do. WinPCap is probably worth a closer look. Good luck.
Rob Kennedy
+1  A: 

If you mean by the system as a whole (and not the application - it's a bit unclear), you could look at WinPCap. There are Delphi wrappers available.

Gerry
I meant to monitor/limit traffic of the delphi application. Thanks for the link, I didn't know that project at all, it seems very cool.
Fred