Yi Meng tcp file transfer and Automatic Update system introduction (TCP File Transfer) (ii)

Source: Internet
Author: User

Yi Meng tcp file upload download and Automatic Update system introduction (TCP File Transfer)

The system is based on the open source Networkcomms communication framework, which was previously charged, is now free and Kaiyuan, the author is the United Kingdom, the development time of more than 5 years, the framework is very stable.

Project Address: Http://www.51aspx.com/code/MSDCArtMengFileUpload

Consulting qq:286275658

Demo Program: HTTP://PAN.BAIDU.COM/S/1GEVFMCR

The principle of automatic upgrade:

(1) After the client is logged in, determine the version number in the local configuration file and the server version number, if it is smaller than the server version number, close this program, start the upgrade program

  //Start the upgrade program        Private voidAppupdate () {
Contact Server Request Server version number Upgradeconfig UPGRADECONIFG= appoutter.tcpconn.sendreceiveobject<string, Upgradeconfig> ("getupmsg","resupmsg", the,"Test");
If the server has a large version number, start the upgrade programif(Upgradeconifg.appversion >getmenuversion ()) {
To get the name of the upgrade program from the configuration file, start the programstringUpgradeapppath = system.configuration.configurationmanager.appsettings["Upgradeapp"]; stringCallBack = AppDomain.CurrentDomain.BaseDirectory +Upgradeapppath; if(File.exists (callBack)) {if(Properties.Settings.Default.IpAddress = = system.configuration.configurationmanager.appsettings["IPAddress"]) {System.Diagnostics.Process Process=System.Diagnostics.Process.Start (CallBack); } Else{System.Diagnostics.Process Process= System.Diagnostics.Process.Start (CallBack,"s"); } } Else{MessageBox.Show ("Target program does not exist"+callBack); } System.Environment.Exit (0); } }

Configuration file for the upgrade program:

Exeappname is the main program name that is configured to restart the main program after the upgrade is completed and after you close itself.

Part of the code:

   Private voidstartupdate () {//Set get file information class priority HighUpgradeconfig UPGRADECONIFG = connection. sendreceiveobject<string, Upgradeconfig> ("getupmsg","resupmsg", the,"Test", Customoptions, customoptions); if(Upgradeconifg.appversion >0) {Listbox1.datasource=upgradeconifg.filelist; TextBox1.Text=upgradeConifg.AppVersion.ToString (); //The number of files that need to be downloadedUpfilescount =UpgradeConifg.FileList.Count; //Send message request download upgrade file                stringFilePath =AppDomain.CurrentDomain.BaseDirectory; //sends the local file's storage path to the server side (which is then brought back by the server-side Sendinfo)Connection. sendobject<string> ("Getupfile", FilePath, customoptions); }            Else{MessageBox.Show ("No upgrade required"); }        }
View Code

After getting the list of files for this upgrade from the server, download the files from the server to local.

After the upgrade is complete, close the program, start the main program, complete the upgrade.

Yi Meng tcp file transfer and Automatic Update system introduction (TCP File Transfer) (ii)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.