dcsimg
Java upload connection speed
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Kevin_Benson
Posted On:   Tuesday, June 29, 2004 09:14 AM

Im writing an applet that send a file to a php file. My question is the following : how can i know the speed of this transfer? My code source : // create a buffer of maximum size bytesAvailable = fis.available(); bufferSize = Math.min(bytesAvailable, maxBufferSize); buffer = new byte[bufferSize]; while (bytesRead > 0) { pvalue+=bufferSize; dos.write(buffer, 0, bufferSize); bytesAvailable = fis.available(); bufferSize = Math.min(bytesAvailable, maxBufferSize); bytesRead = fis.read(buffer, 0, bufferSize); } As u have seen i tried to know how many datas has been s   More>>

Im writing an applet that send a file to a php file. My question is the following : how can i know the speed
of this transfer?



My code source :






// create a buffer of maximum size

bytesAvailable = fis.available();
bufferSize = Math.min(bytesAvailable, maxBufferSize);
buffer = new byte[bufferSize];


while (bytesRead > 0)
{
pvalue+=bufferSize;
dos.write(buffer, 0, bufferSize);
bytesAvailable = fis.available();
bufferSize = Math.min(bytesAvailable, maxBufferSize);
bytesRead = fis.read(buffer, 0, bufferSize);
}





As u have seen i tried to know how many datas has been sent by : pvalue+=bufferSize;
But the dataoutputstream is a thread so pvalue reach immediately the size of the file.
I really need to find a solution, plz help me.

   <<Less
About | Sitemap | Contact