bytes/sec
Scott
kain at cableadmin.com
Sat Aug 12 09:54:05 EDT 2000
This won't quite work right because there is no guarantee that recv will
receive BLOCK_SIZE_IN_BITS bits every time. Perhaps you could do something
like this:
while 1:
t1 = time.clock ()
data = con.recv (BLOCK_SIZE_IN_BITS)
bps = len (data) / (time.cloci () - t1)
if not data: break
## Process your data
Of course, I haven't tested this, so your results may vary.
-Scott
On Sat, 12 Aug 2000 21:08:41 +1000, Steven Adams <adams_s at lab.eng.usyd.edu.au>
wrote:
>*idle musings*
>
>You could just sit inside a loop, each iteration accepting upto a maximum
>number of bits, and measuring the time it takes for each block of data to
>arrive.
>
>e.g. using socket and time
>
> while 1:
> t1=time.clock()
> data = conn.recv(BLOCK_SIZE_IN_BITS)
> bps = BLOCK_SIZE_IN_BITS / (time.clock() - t1) #calculate rate of bits
>per second
> if not data: break
>
>maybe that works, or can be adapted
>
>Steven
--
-------------------------------------------------------------------------------
"That's a deer shooting hat."
"Like hell it is. This is a people shooting hat. I shoot people in this hat."
More information about the Python-list
mailing list