You can't 'know' for sure. Here's your dilemma: For what connection are
you trying to determine bandwidth? Example:
Server sits behind firewall on local network. Client sits behind firewall
on a remote (local) network. Both client and server have say, 100 megabit
or possibly gigabit ethernet connections on the lan. Windows may (I haven't
looked into this, but I'll bet there is) have a method or API to
programmatically determine the link speed of any known lan connection-- you
would probably have to enumerate devices and pull statistics for each.
However, this only tells you the speed of your connection direclty on the
client or the server to the LAN, it doesn't tell you about connections over
which you have no control- ie the wan ports on the router, or any switches
or hubs inbetween. For instance, your T1 connection on your wan will
probably only have a 1megabit speed- but the hardware of the router may have
the capability for 100mb or even 1000mb. As we all know, your maximum
bandwidth is only as fast as your slowest link.
Realistically, as a programmer myself, I would probably have the
server/client pieces do their own analysis. Have them make a connection to
eachother, and put a bandwidth test routine IN the program itself. Ie, pass
a fixed amount of data, and time its transfer time. Example:
starttime = GetTimeHack();
TransferData(nBytesOfData);
endtime = GetTimeHack();
totaltime = endtime - starttime.
[TotalBandWidth = nBytesOfData / totaltime]*
*This last bit will depend on the resolution of your time and how you track
your bytes of data- I'll let you handle the specific formulas.
Now, what this gives you is simply time it took to xmit a fixed batch of
data. It doesn't tell you what anyone's maximum HARDWARE capable throughput
is, it only tells you what throughput it was able to achieve under the
circumstances when a test was run. Meaning that other competing network
traffic, problems, slowness, etc., will LOWER that amount. So again,
subsequent attempts at a test may or will give you slightly different
numbers every time. The only way to get CLOSE to the real maximum
throughput is to stop as much network activity as possible on BOTH SIDES and
start the test. The more extraneous activity you can stop the more accurate
your number will be.
Hope this helps.
Paul
"Ohad" <(E-Mail Removed)> wrote in message
news:cqubvo$74u$(E-Mail Removed)...
> Hello,
>
> I'm a programmer, and am programming a client-server application. I need
the
> server to know what is the bandwidth of the client, i.e., the bandwitdh of
> the internet connection to the client's ISP. How can I get that
information
> (I can implement it either on the server side or on the client side).
>
> Thanks a lot,
> Ohad Asor.
>
>
|