Software Archive
Read-only legacy content
17061 Discussions

Bandwidth determination (Mobile SDK)

atkulp
Beginner
1,257 Views
Using the BandwidthInstance object, I can't seem to access effective application and system bandwidth info. If I access LimitRx or RateRx, I get a CIntelMobileException "Failure Getting Value." SystemRateRx works fine (though it ignore the system-level throttled value), but seems of little value with application/process limits.

What I really want is my actual bandwidth available, taking into account any limit imposed through the Mobile Bandwidth Module (or programmatically). I thought that the problem might be that I had no limits set, but even after setting a limit the same problem persists.

Thanks!
-Arian
0 Kudos
14 Replies
atkulp
Beginner
1,257 Views
Sorry, I neglected to include any system information. This is running Windows Server 2003, SP1 on VMWare Workstation 5.5.
0 Kudos
Intel_Software_Netw1
1,257 Views
We ran this by our engineering contacts, who responded that you should be able to get application bandwidth information programmatically from within the application. Also, you can limit your own application bandwidth, but not someone else's.

If you can post a small re-producer/code segment by which you are trying to achieve this, we will be happy toforwardit to our technical team for further analysis.
Regards,

Lexi S.

IntelSoftware NetworkSupport

http://www.intel.com/software

Contact us

0 Kudos
atkulp
Beginner
1,257 Views
The code segment is pretty simple:

CapabilityClass myCapabilities = new CapabilityClass();
BandwidthInstance myBandwidth;
...
myBandwidth = (BandwidthInstance)myCapabilities.GetInstance("Bandwidth");
...
Console.WriteLine(myBandwidth.LimitRx.GetValue());

This causes the aforementioned exception to occur.

As for your other statement, "you can limit your own application bandwidth, but not someone else's" I'm a bit confused. It appears that this is exactly what is done by the Mobile Bandwidth Module. This tool (included with the SDK) allows you set limits on applications, processes, and sessions. Obviously these are not all owned by the same process, so how is this possible?

Regardless though, my main point is to be able to read my effective allowed bandwidth taking into account limits (whether imposed by the same application or by the included SDK tool).

Thanks!
0 Kudos
Intel_Software_Netw1
1,257 Views
Our engineers responded:
The Bandwidth Manager looks and sets limit/removes limits platform-wide, hence itcan set/access limits for all processes.

The comment about setting bandwidth limits for applications is from within the code (i.e. using BandwidthInstance APIs and properties). In this case you cannot restrict someone else's bandwidth from within your application programmatically.

To see if there are any limits imposed onyour application, you can first call 'LimitedTx/LimitedRx' and if this is true, then call 'LimitTx/LimitRx'. To get transmit/receive rate for calling process,you can use 'RateRx/RateTx'.
Regards,

Lexi S.

IntelSoftware NetworkSupport

http://www.intel.com/software

Contact us

0 Kudos
atkulp
Beginner
1,257 Views
That makes sense about the Bandwidth Module. As for the LimitRx/LimitedRx properties, I can't get the value from there. I wrote the following code to determine Mbps measurements of bandwidth. I really wish I didn't need to check first though. It would be nice to query one property to return what my effective bandwidth is, whether limited or not. It makes sense to also be able to determine if a limit is in effect, but all I really want here is how much bandwidth I have available.

double rx, tx;

if (myBandwidth.LimitedRx.GetValue())
{
rx = (double)1000 * myBandwidth.LimitRx.GetValue();
}
else rx = (double)1000 * myBandwidth.SystemRateRx.GetValue();

if (myBandwidth.LimitedTx.GetValue())
{
tx = (double)1000 * myBandwidth.LimitTx.GetValue();
}
else tx = (double)1000 * myBandwidth.SystemRateTx.GetValue();

When I run this code, CIntelMobileException: "Failure Getting Value" on the LimitedRx property. It turns out that the property is null (IsNull returns true). This complicates the code then by needing to check for IsNull each time.

The thing is, I *have* set a limit for the app in the Mobile Bandwidth Module application. It just doesn't seem to see it.

Thanks for your help so far!
0 Kudos
atkulp
Beginner
1,257 Views
I decided to walk through the properties in the Bandwidth capability. I dumped out the various properties. Does this seem correct?



Name: LimitRx, Null: True, Value: [null]

Name: LimitedRx, Null: True, Value: [null]

Name: PercentRx, Null: True, Value: [null]

Name: RateRx, Null: True, Value: [null]

Name: SystemRateRx, Null: False, Value: 1000000

Name: TheoreticalSystemRateRx, Null: False, Value: 1000000



I don't know if this helps or not, but I'm just confused as to all of the null properties, even with bandwidth limits in place. I have a Gigabit Ethernet adapter (virtual, within VMWare) setup. I have system limits and app-level limits applied. The limits definitely slow down Internet Explorer, so I know that the limits take effect.



Thanks again!
0 Kudos
James_M_Intel1
Employee
1,257 Views

First a note, the product has not been validated on Windows Server nor when running under VMWare. It has been validated on Windows XP. The differences in the OS and the runtime environment may be causing the NULL values.

Can you provide source code that demonstrates the output you posted? Another thing to try is to send some data over the socket you created and then run the test.

Thanks,
Lester Memmott

0 Kudos
atkulp
Beginner
1,257 Views
The output that I posted is simply calling the GetName, GetType, IsNull, and GetValue methods of the Rx properties of the BandwidthInstance object.

As for Server 2003 vs. XP, and VMWare vs. physical machine, I can give that a try and I'll update again. As I said though, the Mobile Bandwidth Module application seems to have no trouble running in this environment, and the limits affect Internet Explorer properly. It's just the SDK calls in the C# app that have the problem. Other than the MTA change, are there any other application settings to take into account?

Thanks!
0 Kudos
James_M_Intel1
Employee
1,257 Views
Given the details provided, it isn't obvious to me what the problem is. Can you modify the test to do the following and we'll see if it fixes the problem:
1. Load the libraries for the Intel Mobile Platform SDK.
2. Create a socket
3. Send some data using this socket
4. Set the bandwidth limit
5. Get the bandwidth limit as describe in the steps listed earlier in this forum thread.
Thanks,
Lester Memmott
0 Kudos
atkulp
Beginner
1,257 Views
Well that brought us further! I had a dialog in the application to set upload/download limits. I would query for the limit, get IsNull, set the limit, and it would still be IsNull! I added a file download earlier in the application, and somehow that has "primed" it. It seems that I need to download a file over a socket each time I change the limits. I'm still working through things in the app, but that's how it appears. If I don't download again, the limit doesn't get changed. I'll send another response when I have any more details.

Also, I'm confused about some of the properties:

1. How is TheoreticalSystemRate different from SystemRate? Both seem to report max rate based on adapter speed (not throttled system rate set in Mobile Bandwidth Module).

2. Do I need to set the LimitedRx/Tx flag to true when I set LimitRx/Tx?

3. Does Adaptive make sense when you can just set a percentage? How would an adaptive percentage even make sense?

4. If I set both PercentRx and LimitRx, which takes precedence? (maybe that's where the Adaptive flag fits in...)

Thanks so much!
0 Kudos
atkulp
Beginner
1,257 Views
I am now running on physical hardware: a Gateway tablet running XP Tablet Edition SP2 with the Mobile Platform SDK installed. I must just be confused. I display a dialog to allow the user to modify the percentage limit. Setting the percentages just doesn't stick. I print the PercentRx value, set it, print it again, and it's still Null:

Console.WriteLine("Before PercentRx = " + (myBandwidth.PercentRx.IsNull() ? -1 : (int)myBandwidth.PercentRx.GetValue()));

// Set the initial values properly, or default to 0
brf.AllowedRx = myBandwidth.PercentRx.IsNull() ? 0 : (int)myBandwidth.PercentRx.GetValue();

if (brf.ShowDialog() == DialogResult.OK)
{
// Set the limit percentages

myBandwidth.PercentRx.SetValue((float)brf.AllowedRx );

Console.WriteLine("After PercentRx = " + (myBandwidth.PercentRx.IsNull() ? -1 : (int)myBandwidth.PercentRx.GetValue()));
}

I'm confused on several fronts. I feel like I must just not be understanding some fundamental concept at work here. For one thing, limits seem overly complicated. How do I just determine my current allowed bandwidth? Do I need to take into account LimitedRx, LimitRx, PercentRx, Adaptive, and TheoreticalSystemRateRx (and then again for Tx)?

Adaptive seems to make little sense. If I set a percentage, what does adaptive mean? It will already be a changing limit based on current speed. Wouldn't it make more sense to set a percentage?

I'm also confused about actual system bandwidth. I have a Gigabit Ethernet adapter and a wireless adapter. Even though the Gigabit adapter has no wire in it and I have an active wireless connection, my SystemRate and TheoreticalSystemRate both return numbers reflecting the disconnected Gigabit link.

Finally, if I set a limit in the Mobile Bandwidth Module tool, shouldn't the application be able to read that in the BandwidthInstance properties at runtime?

So, my problems are:

1) PercentRx/Tx doesn't stick
1.1) When must I set LimitedRx to true? How about Adaptive?
2) System rate seems to include disconnected adapters
3) Not clear how to get numeric system bandwidth, taking into account limits which may or may not be set
4) Limits set in SDK tool not reflected at runtime of app

Thanks!
-Arian
0 Kudos
James_M_Intel1
Employee
1,257 Views

I'm surprised by the need to do a download before a limit change is applied. In general I've seen cases where an initial data transfer needs to be made before the bandwidth control subsystem knows it is there and can have limits set on it. Once the first data transfer is done, limit changes should happen without any more data transfer to make them effective.

Regarding the other items:

1. How is TheoreticalSystemRate different from SystemRate? Both seem to report max rate based on adapter speed (not throttled system rate set in Mobile Bandwidth Module).

Answer: TheoreticalSystemRate is intended to show what the maximum bandwidth would be if all network adapters were used at the same time at their best throughput. If you only have one network adapter on your system currently active, this value would be the same as SystemRate

2. Do I need to set the LimitedRx/Tx flag to true when I set LimitRx/Tx?

Answer: Yes. The LimitedRx/Tx flag is effectively a way of turning limits on and off without having to reset the value of the limit.

3. Does Adaptive make sense when you can just set a percentage? How would an adaptive percentage even make sense?

Answer: In the current implementation we decided to separate out the following two concepts: 1) The limit value. 2)Whether it adjusts with link speed changes or not. For the first, you can set the value using the absolute value or using a percent-based value. Either way, it is represented underneath as an absolute value in the bandwidth control subsystem. For the second part, the limit value will adjust with link speed changes if it is made to be "adaptive". Use the Adaptive property to do it for the whole process or use the SetSessionAdaptive() to make it adaptive for just an individual socket.

4. If I set both PercentRx and LimitRx, which takes precedence? (maybe that's where the Adaptive flag fits in...)

Answer: Which ever you called last. They both set an absolute value in the bandwidth control subsystem.

0 Kudos
atkulp
Beginner
1,257 Views
Ahh! Much clearer now. So perhaps you can't retrieve the Percent properties since they are meaningless once converted to absolute values. I still have a few other questions in the post from earlier today. Thanks again!
0 Kudos
atkulp
Beginner
1,257 Views
Thanks for all of your help so far. I still had two more questions.

1) If I set limits in the Mobile Bandwidth Module, shouldn't those limits be reflected when I query the Limit properties in the app?
1.1) If I set a limit in that tool and in my code, is it last one wins, or does the SDK tool take precedence?

2) What's the recommended method of getting actual available bandwidth? It seems pretty complicated as I understand it. It seems that I must first check LimitRx/Tx, then either LimitedRx/Tx or TheoreticalSystemRateRx/Tx. This still doesn't take into account a 256kbps internet connection through a 100Mbps LAN adapter. Am I making it harder than it needs to be?

Thanks!
0 Kudos
Reply