0

So basically this is an easy question, but not an easy answer.

How do i calculate the download and upload speed in order to make program this in c#?

I'm not sure how to take latency into account.

I hope some of you geniuses can help me with this... :)

thanks in advance.

3
  • You don't have to factor latency into the equation. You simple take the number of bytes per second.
    – Ramhound
    Feb 5, 2014 at 22:36
  • What exactly are you trying to do? If you have a program that will do uploads and downloads, and you want it to report the upload and download speeds it's getting while it's doing those operations, then @Ramhound is right; you just take the number of bytes you've received (or sent) and divide by the number of seconds since you started the file transfer. If you were trying to estimate expected throughput without moving any data, that's a much harder question.
    – Spiff
    Feb 17, 2014 at 19:39
  • @Spiff, I'm trying to make an estimation on expected throughput. I have already established a way to make a transfer of fixed content in order to estimate the UL og DL speed, but i get some other results than e.g. speedtest.net (which i might shamelessly grant as reference)
    – dylf
    Feb 19, 2014 at 10:31

1 Answer 1

0

In short, there are three cases.

1. The physical interface limits throughput.

If the network interface is limiting, then that's the limit (duh :p) and latency does not matter as @Ramhound says.

2. Window limited

If the configured TCP maximum window at either end is limiting then

T <= min(rwnd,cwnd)/RTT

3. Packet loss limited

Packet loss can also limit throughput (by limiting the send window). We learn from The Macroscopic Behavior of the TCP Congestion Avoidance Algorithm that we can get the upper bound on throughput

T <= (MSS / RTT) * C/sqrt(p), 

where p is the packet loss rate, and C is a constant (see article for explanation). This is not exact, there are a number of important assumptions, and different TCP flavors affect this too - but we see that packet loss affects throughput.

I don't quite see how how this helps you write a program in C#, but hope it gives you something :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .