Network upload speed

  • Thread starter Thread starter Peter Morris
  • Start date Start date
P

Peter Morris

Hi all

I want to run a routine in a timer 4 times per second. This routine will
send data over TCP/IP, what I want to know is this. Is there anyway to find
the current upload speed? I want to adjust the amount of data I send based
on how long it is taking to send, I don't want to have loads of data
buffered because the data is a series of samples. I want to send as many
samples as possible per second but sending the latest samples is more
important than sending them all.


Thanks

Pete
 
You should be able to calculate it pretty easily. You're sending x bytes 4
times per second. Turning that into bps or kbps is pretty trivial. You can
even check Environment.TickCount before and after an individual send to get
a more precise value.
 
Hi Chris

That's not quite what I meant. The problem is that I have 30K/Sec I *could*
send, but when sending the data I need to be able to determine that the data
is actually being sent at 3K/Sec so that I know I should only send the first
10% of the samples during this cycle. I need to know the actual upload
speed, I am concerned that if I send 30 * 1KB samples that the TCP/IP stack
will buffer it and give the illusion that I am sending faster than I really
am.

Does that make sense?


Pete
 
No, there's no simple look up for what the actual available bandwidth is.
You can get the characteristics of the adapter on which you are sending the
data. That would tell you whether your Ethernet cable is plugged into a
10BaseT port or a 100BaseT port, for example. That, however, doesn't mean
that you can transmit at 100MBPS; it just means that that is the total
bandwidth. The OpenNETCF network classes can return the network total
bandwidth, if you decide that you want to do something with that.

Paul T.
 
Back
Top