473,486 Members | 2,427 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to reduce the time to download file from server using HTTP connection

27 New Member
Hi,

I m facing some critical problem for downloading 5mb file from server. Does anyone know?



How to reduce the time to download file from server using HTTP connection?



Code I m using is


Expand|Select|Wrap|Line Numbers
  1. HttpConnection URLConn = (HttpConnection) Connector.open(originURL + fileName);
  2.  
  3.         if (URLConn == null) {
  4.  
  5.             URLConn.close();
  6.  
  7.             return;
  8.  
  9.         }
  10.  
  11.         int length = (int) URLConn.getLength();
  12.  
  13.  
  14.  
  15.         // variables to read the origin file
  16.  
  17.         inputStream = URLConn.openInputStream();
  18.  
  19.         try {
  20.  
  21.             fileCon = (FileConnection) Connector.open(DEVICE_PATH + fileName, Connector.READ_WRITE);
  22.  
  23.             if (!fileCon.exists()) {
  24.  
  25.                 fileCon.create();
  26.  
  27.             }else{
  28.  
  29.                 fileCon.delete();
  30.  
  31.                 fileCon.create();
  32.  
  33.             }
  34.  
Thanks in advance.

Thanks,
Vikas Sawant.
Mar 31 '09 #1
1 2752
JosAH
11,448 Recognized Expert MVP
You only showed us the preamble of the entire process; your connection speed is the most important factor for the downloading time here. Try to read 4KB or so blocks every time.

kind regards,

Jos
Mar 31 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
3349
by: Thomas Andersson | last post by:
Hi, I am trying to find a working solution for download of large files (400-800 MB)... But this seems almost impossible to find a working example. I have tried Response.Transmitfile, this...
1
5838
by: Vasu | last post by:
Hi, I have a requirement to download a file from the web site using a client tool. Iam writing a C# program to download using WebRequest, HttpRequest, WebResponse and so on. The problem...
1
1196
by: UJ | last post by:
My client has a product that downloads files from it's web server. It then will display these on a local machine. Problem is that this is on the customer's network which means, depending on the...
14
2061
by: Harry Keck | last post by:
I have client side code that uses xmlhttp to make an asyncronous call to the server. This call really churns the server and can take a couple of minutes to finish. I have found that while this...
7
3362
by: John | last post by:
We have created a game and when the user click on "Download New Songs" which requires the user to download songs. This could be over 20 songs. I have these files zipped on the server in one...
2
23711
by: Dan D | last post by:
I have a large install file (an exe) on my web server that people download and install from. Looking at my log files, I see a lot of people downloading it, but no way to tell for sure if they...
6
2817
by: Simon | last post by:
Dear reader, I have an Access application which works as back-end and front-end. In case it's running on a local PC it works perfect. If I install it on a server the response time is...
1
3274
by: replyrpatil | last post by:
What I am trying to do: I need to print a compact access report (font 6 size) created using RTF2 program developed by Stephen Lebans to generate a TIF image of custom size (5.5 in x 2.0 in) ...
2
7153
by: fepeacock | last post by:
I am breaking/interrupting my connection with the ftp server at present when doing a partial download of a file. I have a callback with retrbinary that raises an exception and ends the download....
0
6964
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...
0
7126
Oralloy
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,...
0
7175
jinu1996
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...
0
7330
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4865
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3070
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.