PDA

Click to See Complete Forum and Search --> : Automated Upgrades


Avatarp
Apr 15th, 2010, 03:08 AM
I have been thinking on how to provide the best way to have my software be automatically upgraded on the client PC. I don't know if this is the best way but hopefully you will let me know.

I will have the setup.exe file on my server which would install only the executable to copy over the existing executable. I would have a text file in the same location on my server with the Version Number to check if it is version is out dated. The text file will also contain other important information for my program to execute. I will likely have SQL Query files to possible execute if their are changes I need to make to the local database.

My Main Application will check a hard coded FTP location to see if their version is less than the one I read from a line in that text file. If it is Get the file using iNet control and close my application when the files have finished closing but on close have a Shell call to run my setup file which runs once my Main program has finished closing.

When my clients restart up my program it will run the queries if any and carry on with the updated version....

Sorry for being wordy...:)

dilettante
Apr 15th, 2010, 07:01 AM
This sounds like the basic outline of what most people try to do. I have a few thoughts on it:

Create backup copies of the old programs, files, and databases before changing anything.

Use a separate, small, well debugged EXE to do most of the run-time updating. If it detects a failure it can put the backups back in place so the user can at least keep working until the problem gets resolved. Version detection and downloading might remain in the main application EXE though. You could even write this as a small script host and download new update scripts to be run each time, which can be less work to maintain and lets you keep the updater EXE stable and reliable.

FTP is a problematic protocol. Often using passive mode will allow it to work through most firewalls, but not all. HTTP is a much more reliable option. Though HTTP might be proxied to block certain classes of Web sites, most firewalls will allow it through - a no-HTTP policy at a site would render an Internet connection pointless. So look into using a WebDAV server to host your files instead of an FTP server. This also means you can use HTTPS to secure the user/pw used to access the server, unlike FTP wich sends credentials in plain text.

Of course most VB/VB.Net programmers seem pretty unfamiliar with WebDAV for some reason.

Avatarp
Apr 18th, 2010, 01:20 PM
My program will be installed on select computers in each location. I will be creating an exception on port 21 to allow for my program to FTP upload various files and retrieve updates as they are released.

This HTTP process looks more stable. Am I able to have an HTTP directory protected with Username and Password? Do you have a good tutorial on HTTP transfers? I will look and see what I can see.

dilettante
Apr 18th, 2010, 05:22 PM
You shouldn't need to configure a firewall exception for outbound FTP on port 21. These are seldom closed, though they could be I suppose. The usual problem is that by default most FTP clients expect the FTP server to connect back to them on a randomly assigned port. This is the real FTP problem.

Most FTP clients can select the "passive" option, which means when a file or directory list needs to be transferred the client can open a second port out to the server. But FTP always uses two connections: one as a command channel and the other to move files and things like directory listings. This also uses a random port number, and might be blocked going outbound too I suppose (rare).


If your program only needs to download data, like a version-check file and then a new program package, or data files, etc. then you can do the necessary HTTP GET requests using just VB6 (using the AsyncRead method - there are demos in the CodeBank here).

If VB.Net there are other simple options for doing HTTP GETs.

If you need these files to be in locations protected by a user/pw, you can include this information in the URL or use one of the more sophisticated HTTP components that allow you to supply them as properties. For VB6 this could be the INet control, the XMLHTTPRequest object, the WinHTTP object, etc.

In VB.Net there are similar facilities in the Framework.


There should be a ton of threads on doing this sort of thing here, both in VB6 and in VB.Net. These topics are also covered in the documentation, for example:

Microsoft Internet Transfer Control (http://msdn.microsoft.com/en-us/library/aa239740(VS.60).aspx)