473,715 Members | 5,414 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Slow Downloading

Hi,
I have a problem downloading a file .
after i connect to the website and get the stream , i treing to write
the file on the HD.
public void SaveStreamToFil e(string filePath, Stream stream)
{
// If not all data was provided return false;
//if (string.IsNullO rEmpty(filePath ) || stream == null)
// return false;
// System.IO.Strea m gzStream = stream; //= new
System.IO.Strea m()//(stream,
System.IO.Compr ession.Compress ionMode.Decompr ess);
FileStream fs = null;
try
{
byte[] inBuffer = new byte[10000];
int bytesRead = 0;
fs = File.Open(fileP ath, FileMode.Create ,
FileAccess.Writ e, FileShare.Read) ;
while ((bytesRead = stream.Read(inB uffer, 0,
inBuffer.Length )) 0)
{
fs.Write(inBuff er, 0, bytesRead);
}
fs.Flush();
// return true;
}
catch (Exception ex)
{
throw ex;
// ExceptionPolicy .HandleExceptio n(ex, "Global
Policy");
//return false;
}
finally
{
fs.Close();
}
}
webRequest1.Kee pAlive = true;
webRequest1.Coo kieContainer = cookies;
webRequest1.Acc ept =
"text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,ima ge/png,*/*;q=0.5";
webRequest1.Hea ders.Set("Accep t-Language",
"en-us,en;q=0.5");
webRequest1.Hea ders.Set("Accep t-Encoding", "gzip,deflate") ;
webRequest1.Hea ders.Set("Accep t-Charset",
"ISO-8859-1,utf-8;q=0.7,*;q=0.7 ");
webRequest1.Hea ders.Set("Keep-Alive", "300");
WebResponse myResponse1 = webRequest1.Get Response();
Stream ReceiveStream1 = myResponse1.Get ResponseStream( );
SaveStreamToFil e(@"C:\file.csv ", ReceiveStream1) ;

the problem is that if i want to download a file (as big as 3Mb) it
takes me 40min to do it .
(my internet connection is fast)

please suggest me , how to solve this problem .
Thanks , Rony

Aug 17 '06 #1
0 878

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
3085
by: Mark P | last post by:
I have a bit of vb code that uses Tables.Append to programatically link tables from Oracle and DB2 datasources. The problem I am having on some client machines is that the link will take anywhere from 1 to 3 minutes to link the table. When I manually link the tables,through Access, it takes no time at all. Note that only certain client have the problem, and the problem will sometimes go away. These clients will usually get an ODBC Call...
5
618
by: No_Excuses | last post by:
All, I am interested in reading the text of a web page and parsing it. After searching on this newgroup I decided to use the following: ******************************* START OF CODE ************************ String sTemp = "http://cgi3.igl.net/cgi-bin/ladder/teamsql/team_view.cgi?ladd=teamknights&num=238&showall=1"; WebRequest myWebRequest = WebRequest.Create(sTemp); WebResponse myWebResponse = myWebRequest.GetResponse();
1
2081
by: just.starting | last post by:
Hi, My dot net client downloads files and checks for any new files time to time. The server is apache2.0.53 server. So what happens is that my file download thing works fine if I dont try to call any page from the server while downloading. If I try to call a single page while downloading a file then the page request goes time out and the server then closes the existing download stream and the client doestn't throw any exception. So many a...
0
1637
by: just.starting | last post by:
I am having problem while downloading files from an apache server2.0.53 with php4.3.10.While downloading some files it generally stops after downloading some specific amount and then stops downloading with the error message: "the source file could not be read". And the error is not dependent on the size of the file, as I can download a file of 6MB but having problem with a file with 652KB. It always stops after 666880bytes. Thanks.
1
1264
by: tsbgrp | last post by:
hi there i have a problem related to slow downloading speed.the situation is i have about 60 PC's in a domain.when i ping ISP Gateway from a LAN PC i get the replies...22, 25,35, 400, 50ms an some times 22, 40, 220, 150, 30, 100ms...I get lot of variations and when i ping from server PC by disconnecting LAN then i get theese replies ... 15,16,24.26ms. the range is max from 15 to 26ms. there is no problem with ISP. problm definitly lies...
3
2213
by: Mantorok | last post by:
Hi all I'm writing a newsgroup reader in C# and I've found the TcpClient to be extremely slow, when downloading a list of newsgroups for example it runs at about 8Kb/sec over a 2Mb/sec connection. Any ideas? Is this just the way it is?? Thanks Kev
5
1853
by: rony_16 | last post by:
Hi, I have a problem downloading a file . after i connect to the website and get the stream , i treing to write the file on the HD. public void SaveStreamToFile(string filePath, Stream stream) { // If not all data was provided return false; //if (string.IsNullOrEmpty(filePath) || stream == null) // return false; // System.IO.Stream gzStream = stream; //= new
6
1924
by: bg_ie | last post by:
Hi, My company's backend is located at a location with a long address, something like - //our_servers/server_number_one/our_department/our_devision/ our_results/our_databases/backend.be I have tested the very same backend on another server with a sort path location at it works fine, but at the location above it is extremely
5
1307
by: Geoff Cox | last post by:
Hello, I have a page for which downloading into the browser is very slow. I have tried using YSlow and firebug but is there any way in which I can actually see which files are taking a long time to be downloaded? Cheers Geoff
39
2869
by: cm_gui | last post by:
Python is slow. Almost all of the web applications written in Python are slow. Zope/Plone is slow, sloow, so very slooow. Even Google Apps is not faster. Neither is Youtube. Facebook and Wikipedia (Mediawiki), written in PHP, are so much faster than Python. Okay, they probably use caching or some code compilation -- but Google Apps and those Zope sites probably also use caching. I've yet to see a web application written in...
0
8718
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,...
0
9343
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, 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...
0
9198
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 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...
0
9047
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7973
agi2029
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...
1
6646
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5967
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();...
0
4738
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2119
bsmnconsultancy
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...

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.