473,753 Members | 7,291 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Automatic updating.

Hi,

I'm developing an app with automatic version checking and updating. It must
also track what version is installed for each customer in our customer
database. I have made a small client to fetch updated file(s) from the net
and copy over the old files. I figured this must be done since the program
itself will be read/write locked as long as it is running. I have a
progressbar prgDownload that shows the download progress. My main problem
right now is that the download is extremely slow the way I have programmed
it to make it work with the progress bar.

I have also looked into the Application Updater Block
(http://dotnetjunkies.com/WebLog/bsbl...10/16118.aspx), but
I don't think this is applicable to my solution since I need to keep track
of installed versions and I also need some custom checking on when updates
are needed.

Anyone have any suggestions to how I can speed up the download? Or perhaps
totally different approaches to what I'm trying to accomplish? Any help will
be greatly appreciated. The speed problem is probably because I read and
write one byte at a time, guess I need to use BufferedReader or something
similar, but I need some code examples to make it work.

Old code without progressbar (fast download):

// // Create a web client.

// WebClient wc = new WebClient();

//

// // The file name.

// string fileName = Application.Sta rtupPath + Path.DirectoryS eparatorChar +
"Transport.tmp" ;

//

// // Delete the old file if it exists.

// File.Delete(fil eName);

//

// // Download the file.

// wc.DownloadFile ("http://proteria.com/files/Transport.exe",
Application.Sta rtupPath

// + Path.DirectoryS eparatorChar + "Transport.tmp" );

New code that works with progress bar but is VERY SLOW:

Uri downloadLoc = new Uri("http://proteria.com/files/Transport.exe") ;

HttpWebRequest req = (HttpWebRequest ) WebRequest.Crea te(downloadLoc) ;

WebResponse rsp = req.GetResponse ();

Stream inStream = rsp.GetResponse Stream();

// BufferedStream bs = new BufferedStream( inStream);

File.Delete(App lication.Startu pPath + Path.DirectoryS eparatorChar +
"Transport.tmp" );

FileStream fs = File.Create(App lication.Startu pPath +
Path.DirectoryS eparatorChar + "Transport.tmp" );

prgDownload.Pro perties.Step = 1;

prgDownload.Pro perties.Percent View = true;

prgDownload.Pro perties.Maximum = (int)(rsp.Conte ntLength/4096);

prgDownload.Pro perties.Minimum = 0;
int i = 0;

while(true)

{

int i = inStream.Read() ;

if(i == -1)

break;
fs.WriteByte((b yte)i);

prgDownload.Inc rement(70);

prgDownload.Upd ate();

}
Nov 16 '05 #1
2 1874
Trygve,

I'm not sure if you can wait, but have you checked out the ClickOnce
solution that is going to be delivered with .NET 2.0? It will address all
of the needs that you have, with minimal code.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Trygve Lorentzen" <trygveloAThald enDOTnet> wrote in message
news:Oz******** ******@TK2MSFTN GP09.phx.gbl...
Hi,

I'm developing an app with automatic version checking and updating. It
must
also track what version is installed for each customer in our customer
database. I have made a small client to fetch updated file(s) from the net
and copy over the old files. I figured this must be done since the program
itself will be read/write locked as long as it is running. I have a
progressbar prgDownload that shows the download progress. My main problem
right now is that the download is extremely slow the way I have programmed
it to make it work with the progress bar.

I have also looked into the Application Updater Block
(http://dotnetjunkies.com/WebLog/bsbl...10/16118.aspx),
but
I don't think this is applicable to my solution since I need to keep track
of installed versions and I also need some custom checking on when updates
are needed.

Anyone have any suggestions to how I can speed up the download? Or perhaps
totally different approaches to what I'm trying to accomplish? Any help
will
be greatly appreciated. The speed problem is probably because I read and
write one byte at a time, guess I need to use BufferedReader or something
similar, but I need some code examples to make it work.

Old code without progressbar (fast download):

// // Create a web client.

// WebClient wc = new WebClient();

//

// // The file name.

// string fileName = Application.Sta rtupPath + Path.DirectoryS eparatorChar
+
"Transport.tmp" ;

//

// // Delete the old file if it exists.

// File.Delete(fil eName);

//

// // Download the file.

// wc.DownloadFile ("http://proteria.com/files/Transport.exe",
Application.Sta rtupPath

// + Path.DirectoryS eparatorChar + "Transport.tmp" );

New code that works with progress bar but is VERY SLOW:

Uri downloadLoc = new Uri("http://proteria.com/files/Transport.exe") ;

HttpWebRequest req = (HttpWebRequest ) WebRequest.Crea te(downloadLoc) ;

WebResponse rsp = req.GetResponse ();

Stream inStream = rsp.GetResponse Stream();

// BufferedStream bs = new BufferedStream( inStream);

File.Delete(App lication.Startu pPath + Path.DirectoryS eparatorChar +
"Transport.tmp" );

FileStream fs = File.Create(App lication.Startu pPath +
Path.DirectoryS eparatorChar + "Transport.tmp" );

prgDownload.Pro perties.Step = 1;

prgDownload.Pro perties.Percent View = true;

prgDownload.Pro perties.Maximum = (int)(rsp.Conte ntLength/4096);

prgDownload.Pro perties.Minimum = 0;
int i = 0;

while(true)

{

int i = inStream.Read() ;

if(i == -1)

break;
fs.WriteByte((b yte)i);

prgDownload.Inc rement(70);

prgDownload.Upd ate();

}

Nov 16 '05 #2
Hi,

and thanks for your answer. Yes, I'm aware of the ClickOnce solution.
Actually we were hoping to use Zero Touch Deployment, but that didn't seem
mature enough at the time. No status indicator when downloading, slower
performance etc. Basically, we can't wait, but do you have any idea when
..NET 2.0 will be out? We have sceduled a beta release at the end of the
month...

If you have any suggestions to solve my download issues, I'd be greatful
too.

Cheers,
Trygve

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:uJ******** ******@TK2MSFTN GP10.phx.gbl...
Trygve,

I'm not sure if you can wait, but have you checked out the ClickOnce
solution that is going to be delivered with .NET 2.0? It will address all
of the needs that you have, with minimal code.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Trygve Lorentzen" <trygveloAThald enDOTnet> wrote in message
news:Oz******** ******@TK2MSFTN GP09.phx.gbl...
Hi,

I'm developing an app with automatic version checking and updating. It
must
also track what version is installed for each customer in our customer
database. I have made a small client to fetch updated file(s) from the net and copy over the old files. I figured this must be done since the program itself will be read/write locked as long as it is running. I have a
progressbar prgDownload that shows the download progress. My main problem right now is that the download is extremely slow the way I have programmed it to make it work with the progress bar.

I have also looked into the Application Updater Block
(http://dotnetjunkies.com/WebLog/bsbl...10/16118.aspx),
but
I don't think this is applicable to my solution since I need to keep track of installed versions and I also need some custom checking on when updates are needed.

Anyone have any suggestions to how I can speed up the download? Or perhaps totally different approaches to what I'm trying to accomplish? Any help
will
be greatly appreciated. The speed problem is probably because I read and
write one byte at a time, guess I need to use BufferedReader or something similar, but I need some code examples to make it work.

Old code without progressbar (fast download):

// // Create a web client.

// WebClient wc = new WebClient();

//

// // The file name.

// string fileName = Application.Sta rtupPath + Path.DirectoryS eparatorChar +
"Transport.tmp" ;

//

// // Delete the old file if it exists.

// File.Delete(fil eName);

//

// // Download the file.

// wc.DownloadFile ("http://proteria.com/files/Transport.exe",
Application.Sta rtupPath

// + Path.DirectoryS eparatorChar + "Transport.tmp" );

New code that works with progress bar but is VERY SLOW:

Uri downloadLoc = new Uri("http://proteria.com/files/Transport.exe") ;

HttpWebRequest req = (HttpWebRequest ) WebRequest.Crea te(downloadLoc) ;

WebResponse rsp = req.GetResponse ();

Stream inStream = rsp.GetResponse Stream();

// BufferedStream bs = new BufferedStream( inStream);

File.Delete(App lication.Startu pPath + Path.DirectoryS eparatorChar +
"Transport.tmp" );

FileStream fs = File.Create(App lication.Startu pPath +
Path.DirectoryS eparatorChar + "Transport.tmp" );

prgDownload.Pro perties.Step = 1;

prgDownload.Pro perties.Percent View = true;

prgDownload.Pro perties.Maximum = (int)(rsp.Conte ntLength/4096);

prgDownload.Pro perties.Minimum = 0;
int i = 0;

while(true)

{

int i = inStream.Read() ;

if(i == -1)

break;
fs.WriteByte((b yte)i);

prgDownload.Inc rement(70);

prgDownload.Upd ate();

}


Nov 16 '05 #3

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

Similar topics

3
2088
by: Todd Cary | last post by:
Some of my clients would like to have a way to update text and tables in their HTML pages without the need for or understanding of complicated updating programs. Does such a program exist? My concept is to have tags embedded within the page that would be recognized by the application. Transparently the "tagged areas" would be updated using nothing more that Excel and or Word (everything behind the scene would be done automatically -...
52
5458
by: Gerard M Foley | last post by:
Can one write a webpage which is not displayed but which simply redirects the user to another page without any action by the user? Sorry if this is simple, but I am sometimes simple myself. Happy New Year -- Gerry
2
3122
by: The List Man | last post by:
Crontabs for automatic site updates. Does anyone know how to set up a crontab for automatically updating a webpage on a regular basis. We know how to set these to run perl files, but seem to have an issue as far as comming up with the command to copy one html file to replace another. Any help or simple scripts to do this will be greatly appreaciated. -- The List Man
1
3739
by: Rene Crespo | last post by:
Hello, Sorry about the length of this explanation! I am using Access 2000 to assist an export sales department keep track of its weekly offers of products to clients. The database already keeps track of "product offers" and prepares a report that a group of Clients can receive by email or fax each week. The challenge is that not all clients are interested in all the "items" on the product offers (more than 200 items listed). While...
5
2375
by: Shane | last post by:
I wonder if someone has any ideas about the following. I am currently producing some reports for a manufacturing company who work with metal. A finished part can contain multiple sub-parts to make up the finished part. The sub-parts can also be made up of sub-parts and those sub-parts can also be made up of sub-parts etc etc. All parts are contained within the same table and I have a seperate table
2
1979
by: Sky | last post by:
Hello, The books on C# I have read talk of using the DataSets in disconnected mode, and Adding/Removing/Updating records from it, and letting it handle all the updating on the Database in one batch finale... But the examples were all based on using auto-increment columns. Lately I've been backing away from Auto-Increment columns to move to 'uniqueidentifier' guid columns instead for my Key columns -- to allow for better synching arch....
1
2719
by: rdemyan via AccessMonster.com | last post by:
My App has 10 or so tables that we provide that contains proprietary data. This data will need to be updated once or twice a year. I would like some comments, suggestions on my proposed strategy for updating these tables via an ftp site: 1) Post a .mdb file to our ftp web site that contains the updated tables. My App code connects to the ftp site and gets the file name for any update files on the site. I already have code to do this...
0
922
by: RG | last post by:
I have a stored procedure which is called by db2 "call ....." statement from ksh script. When running from AIX DB2 v. 9.1.3 environment, after a while the stored procedure starts to hang and snapshot says it is on fetch statement. The job of the stored procedure is to loop through the cursor executing ddl command found in one of the columns and updating the table which is cursored. It is using handler and hold options.
3
4650
by: myjish18 | last post by:
Hello, We have a DB2 UDB database v8.2.7 (db2 v8.2 fixpak 14) on AIX 5.3 which has Automatic Storage (AS) enabled. We want to disable automatic storage on entire database and/or disable automatic storage on all tablespaces. DB2 Manual says it once AS is enabled, it cant be changed. Is there any way to disable the AS or any other alternative? Please advice.
0
9072
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...
0
9333
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
8328
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
6869
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
6151
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
4942
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3395
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
2872
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2284
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.