RTC Forums
May 05, 2024, 05:26:11 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: Calc Bandwidth For Each Connection  (Read 3971 times)
DonR
Newbie
*
Posts: 3


« on: May 28, 2010, 04:38:57 PM »

Hi Danijel,

Is there an easy way to measure bandwidth for each connection on a server during file uploads? I assume it can be calculated in the OnDataReceived event by saving the time each OnDataReceived is fired?

It would also be great to have a method to limit connection bandwidth. I would want to be able to determine the bandwidth of all current connections and then throttle back a few to avoid additional bandwidth charges from my data center.

Thanks

Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 on: May 28, 2010, 06:25:55 PM »

You should be able to use OnDataIn and OnDataOut events to calculate your currently used bandwidth.

As for bandwidth control, I'm afraid there is no elegant way (no properties you could set) to force downloads or uploads to slow down using the current stable RTC SDK release (2010 Q2), but you might be able to get it working by injecting Sleep() calls inside OnDataIn and/or OnDataOut events when you think too much bandwidth is being used.

Best Regards,
Danijel Tkalcec
Logged
Kevin Powick
RTC Expired
*
Posts: 87


« Reply #2 on: May 31, 2010, 01:10:40 AM »

Not that I am in any need of it, but maybe bandwidth throttling could be a future enhancement?  It might be a good property to have on both client and server components.

--
Kevin
Logged

Linux is only free if your time is worthless
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #3 on: May 31, 2010, 08:51:18 AM »

If anyone needs to reduce bandwidth usage, the easiest way to implement sending and receiving speed reduction is to use Sleep inside OnDataIn and OnDataOut events. When writing my first reply (above), I through that using Sleep would be a bad idea because it will result in RTC threads being occupied while waiting (sleeping), but if you want to slow down sending and receiving through all connections, keeping threads occupied in a Sleep is actually a positive side-effect. And since OnDataIn and OnDataOut events are being called directly from the lowest API access layer in the RTC SDK (where the actual sending and receiving is being done), it gives you the same level of control as if you were extending the RTC SDK.

Best Regards,
Danijel Tkalcec
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.024 seconds with 17 queries.