This is a set of tools with which you can easily distribute automatic software updates to your clients.
As you see in picture1 the ideal workflow to your clients is a direct line.
To get such an theoretical way working in an acceptbale way (in this solution), you will need to take the detour to the webserver. That means:
- You publish your updates to your webserver
- Your Application running at the customers site will fetch and install them automatically
How does it work?
As you see in picture2 the update-toolset consists of 3 different parts:
- the Updatecreator at the producers site - With the tool, your update is packed and distributed out to the world.
- the Updateclient at the customers site - This class is inserted in your app. You're responsible to call for it. (for example each time the application starts up or periodically)
- the Client Updater at the customers site - This is a standalone-program that is called and configured by the Updateclient-class; it closes down the main application, does the unpacking and copying and restart the application finally.
- the Webserver anywhere accessible by both - The Webserver stores the update-information and the update-files; currently with mysql/php and for uploading ftp
This program uses
Explanation of the basic functions
- Project is compiled
- uploaded to the webserver
- online-database is updated with the new version
- UpdateClient is called to check for updates
- it request the actual version from the webserver
- it recaives the actual version number and compares it to its own hardcoded number
- when the online-version is newer, the update is fetched, otherwise the updatecheck is finished at this step.
- receive the update-file and saves it to a temporary folder
- unpacks to that temporary folder
- atm: only copies all content over the old one, without checking something
Using the codeSet up the mysql table at the webserver:
# Table structure for table `version`
CREATE TABLE version (
projectid int(11) NOT NULL default '0',
projectname text NOT NULL,
actualversion int(11) NOT NULL default '0',
PRIMARY KEY (projectid)
Create a update.php script with following content:
mysql_connect("mydbserver.com","dbuser","dbpassword") or die(mysql_error());
mysql_select_db("mydb") or die(mysql_error());
"SELECT * FROM version WHERE projectname='".$_GET["project"]."'");
"UPDATE version SET actualversion=".$_GET["version"]."
Upload the update.php to the location specified in your updateclients. Don't forget to create the directory for the updates! integrate it into your application:
Public Class Form1
Dim WithEvents updater As updateclient.clsClient
Private Sub Form1_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
updater = New updateclient.clsClient
Private Sub updater_endall() Handles updater.endall
Public Const ProjectName As String = "yourappname"
Public Const VersionNumber As Integer = 25
Public VersionDate As Date = New Date(2004, 10, 25) End Module
Points of Interest
Updates become more and more important in this fast-moving buisness. This toolset is just a fast-hacked starting point using the concept mentioned. You'll note that there exists no error handling, and many many more usefull features that are not included yet. Can your improve the concept or the toolset in any way?
Thomas is interested in technical programming, networking and security technologies.
Currently he's studying at a german university