473,698 Members | 2,029 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 875

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

Similar topics

18
3079
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
2078
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
1635
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
1263
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
2212
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
1922
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
1306
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
2861
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
8668
marktang
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...
1
8884
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,...
0
8855
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
5857
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
4358
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4611
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3034
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 we have to send another system
2
2319
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1992
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.