tags:

views:

168

answers:

4

What is the best way to determine available bandwidth in .NET?

We have users that access business applications from various remote access points, wired and wireless and at times the bandwidth can be very low based on where the user is. When the applications appear to be running slow, the issue could be due to low bandwidth and not some other issue.

I would like to be able to run some kind of service that would warn users whenever the available bandwidth dips below a specific threshold.

Any thoughts?

+2  A: 

Not beyond the obvious of downloading a file of a known size and timing how long it takes. the disadvantage of that is that you'd need to waste a lot of bandwidth to do it. Also, if you wanted to alert when throughput drops below a threshold, you'll have to run the test more-or-less continuously.

IMHO, I'd live with poor performance in some locations, given that you can't do anything about it if it does occur.

Sorry.

ZombieSheep
A: 

If you're transferring data, simply measure it. You could also download a reference object from somewhere if you want to make it independent of the speed of your server.

MattW.
A: 

There's no easy way to measure bandwidth without actually using it - which of course will starve the applications. A couple of points to bear in mind though:

1) Is it actually bandwidth that's the problem, or latency? You can measure latency in a less intrusive manner than bandwidth.

2) Are the applications all run from the same server (or at least the same network)? You may find that users will have a good connection to some areas of the net but not others. (It's likely that the last mile will be the limiting factor, but it's not always the case.)

Jon Skeet
A: 

Without knowing the exact nature of your connection, or how its used, there are two options that I am aware of.

MultinetGetConnectionPerformance (http://msdn.microsoft.com/en-us/library/aa385342(VS.85).aspx)

System Event Notification Service (http://msdn.microsoft.com/en-us/library/aa377538(VS.85).aspx)

Neither are direct .NET classes, but can be implemented in .NET very easily.

Take a look at both of them and see if they will work for you.

Roy