M
mscdex
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
Write bytes just read in to file via a FileStream object
byteCount += bytesRead
Update progress bar for transfer
End While
I have tried somehow using a TimeSpan object to attempt to calculate
after I update the progress bar, but that has proved to not only work
for me, but it makes the transfer rate display not update evenly.
I've looked on the net for any samples of this, but could not turn up
anything.
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
Write bytes just read in to file via a FileStream object
byteCount += bytesRead
Update progress bar for transfer
End While
I have tried somehow using a TimeSpan object to attempt to calculate
after I update the progress bar, but that has proved to not only work
for me, but it makes the transfer rate display not update evenly.
I've looked on the net for any samples of this, but could not turn up
anything.