I'm using the HttpWebRequest/Response methods and I'm trying to figure
out how to calculate the effective transfer rare the file is being
received at (like you see in IE when you download something). I have
already learned how to do a "progress bar" type solution, which lets
me calculate percentages. This is different however, because rate
implies time.
I've tried making a timer that goes off once a second and then
applying (bytes downloded now - bytes downloaded last interval), I get
inaccurate speed (584 KB/s when it's more like 230 KB/s)
then I tried recording the ticks between 2 successive read calls in a
loop, dividing that by the number of ticks in a second, getting the
inverse of that and multiplying by 4 (bc my buffer is 4k). Still no
good
If anyone has any solutions I'd love to hear them. Thanks. 2 5513
I did something like this... It seems accurate
//SPEED STUF
counter++
int speed=lsize/counter
guid.labelSpeed .Text=speed.ToS tring()+" Kb/s"
this code is in my Timer1_Tick method, it is called every second. counter is type int and every second it is divided into the size of the file being downloaded to my hard drive. So if lsize = 126KB and counter =9; my download speed would be 14Kb/s (126/9=14). At least I think this is how it worked... I havent looked at this code in a longggg time
It sounds good to me. I just take the size of how much of the file has been placed on my drive, then divide the size by the amount of time it took to get that much. Yeah. this should work fine.
None <ma*******@hotm ail.com> wrote: I'm using the HttpWebRequest/Response methods and I'm trying to figure out how to calculate the effective transfer rare the file is being received at (like you see in IE when you download something). I have already learned how to do a "progress bar" type solution, which lets me calculate percentages. This is different however, because rate implies time.
I've tried making a timer that goes off once a second and then applying (bytes downloded now - bytes downloaded last interval), I get inaccurate speed (584 KB/s when it's more like 230 KB/s)
then I tried recording the ticks between 2 successive read calls in a loop, dividing that by the number of ticks in a second, getting the inverse of that and multiplying by 4 (bc my buffer is 4k). Still no good
Don't multiply by the buffer size - multiply by how many bytes you
actually received, which may not be the same as the buffer size.
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: David C. Holley |
last post by:
Real quick, please refresh my memory which one of the following
preserves the information that was posted from a form?
server.execute
server.transfer
response.redirect
I need to have a page execute if an error occurs while processing a page
|
by: Bob |
last post by:
Hi.
I'm developed a simple Transfer File program just to test the NetworkStream
class. I want to know how can i get the transfer rate speed.
Does someone know how to do it? And... what's the size limit for the
transfer buffer? I set the buffer size to 1MB. It's ok? This is the code:
private void TransferFile(Socket clientConnection, string fileName)
{
NetworkStream ClientBridge;
FileStream FileToTransfer;
|
by: c676228 |
last post by:
Hi,
I am new to this discussion forum. I started to post questions on this forum
since this Jan. and got many good responses and I am very appreciated to
those who are willing to help with their expertise. That save me a lot of
time and stress.
I want to rate the post, but I only see questions "is this post helpful" and
" why should I rate a post" link. I didn't see any thing "rate the post"
link. I already sign into the community...
|
by: Programador |
last post by:
I'm getting this error when running this program:
Cannot calculate rate using the arguments provided
Module Module1
Sub Main()
Rate(360, -694.44444444444446, 244274.69178082192)
End Sub
|
by: Peter Silva |
last post by:
Hi folks,
I have a need in a network data distribution application to send out
data to folks who want it using the protocol of their choice. I´d
like it to support a variety of protocols and I don´t want to
implement any of them :-)
http, ftp (via ftplib) , https (dunno how yet), ssl, ssh, sftp (via
paramiko)
The thing is... I want rate-limiting so that in the case of a failure
| |
by: mscdex |
last post by:
I have a server application that accepts file transfers (utilitzing
tcplistener) and was wondering how I would efficiently go about
determining the calculate transfer rate while I am transferring the
file. The Sub where the transfer actually takes place is called
asynchronously.
The (psuedo) code in the Sub goes something like this:
While byteCount < filesize
bytesRead = Bytes read from NetworkStream
|
by: madgunnercurz |
last post by:
i currently have a database for tracking members arrival and exit
times. however due to new demands my training centre are wanting a
barcode system setup where all the user has to do is use a wedge
scanner and not need to touch the mouse or keyboard. i can
successfully clock in but i am havin difficulties when it comes to
clocking out i am no good with VBA code but if anyone could help me
with if true statements or other ways to produce...
|
by: Dimitrios Apostolou |
last post by:
Hello list,
I want to limit the download speed when using urllib2. In particular,
having several parallel downloads, I want to make sure that their total
speed doesn't exceed a maximum value.
I can't find a simple way to achieve this. After researching a can try
some things but I'm stuck on the details:
1) Can I overload some method in _socket.py to achieve this, and perhaps
|
by: whatazor |
last post by:
Hi,
how can I calulate transfer rate to a host , without using a file ?
can ping module (written by Jeremy Hylton) be useful ?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |