read text file from web server

Hi,

my project is a desktop app on Mac OSX. It read a text file on web server which contains a version number and other info, so the app can compare it with its own version and decide if pop up a window to notify user to donwload new verison or not. My app is not in the App Store, I need a method to notify the end user to update the app.

When I using HTTPSocket.Get, if the text file is exist on server, I can put the content into a string. But if the file is not exist, it still can get a string, such as “404 page not found…”.

My question is, besides parsing the string and using text as identification, is there other methods to tell the difference, such as an error code?

I tried HTTPSocket.LastErrorCode, in both situations, it returns 0(zero), which means no error.

Moreover, as I mentioned above, my app is not in the App store, so what’s the common/professional method to notify end user to update the app? I don’t want too fancy methods, just a notification is quite enough. There is no need to be an updater or something like that. (I know MonkeyBread has a plug-in)

Thanks in advance.

is the file on DropBox? Then you must use SecureSocket

You could use HTTPSocket.HTTPStatusCode. That should return an integer of 404 if the page is not found, 200 if it loaded.

You could always implement an updater with the open-source, free Kaju class.

Nop, regular server. But thanks for the remind.

Thanks!

Interesting, I will try this to see how it works! Thanks!

I tried Kaju but got error, I couldn’t run Kaju Admin App thru my project.
I follow the steps on github

1 - Copy the Kaju Classes folder into your project.
2 - Add to your App instance the property UpdateInitiater As Kaju.UpdateInitiater. You do not need to do anything more with this property.
3 - Run the Kaju Admin app through the included project and save a new document with an appropriate name, something like “MyApp v.1.kaju”. You don’t have to add any updates at this time.
4 - Copy the RSA public key with the appropriate button. A key pair is generated every time a new document is created and it is this key that will ensure that your app is getting legitimate, uncorrupted update information. Do not lose this file after releasing your app! If you do, users of older versions will no longer be able to update.
5 - In an appropriate place within your project, add code that looks something like this:
dim updater as new Kaju.UpdateChecker( myAppPrefFolder )
updater.ServerPublicRSAKey = “12345…” // The key you copied from the Admin app
updater.UpdateURL = “http://www…” // Where the update info will be posted

updater.Execute

Here is one of my screenshot.
There are five errors, I hope it is clear in the pic.
picture click here

you can embed the picture by replacing dl=0 with raw=1

How did you copy the classes into your project? You can’t just drag the folder in unfortunately. You have to open the admin project, then copy and paste the classes into your project.

I don’t understand, open the admin project then copy and paste the classes into your project.
I don’t have a specific folder for my project. My project files include a XOJO XML project file and a folder, named “build-…”, all other dependent files, background pics, logos are all drag and drop in my project from different locations.
What should I do to copy and paste the kaju classes? How can I do that?

PS: Here is what I have done,

  1. I create a new folder, put my project XOJO XML project file in it.
  2. Copy Kaju-1.5.1 and paste it in the new created folder
  3. Drag and drop the kaju folder into XOJO.

No.

Open you project in Xojo. Open the Kaju Admin project in Xojo. Now you have two projects side-by-side.

In the Kaju Admin project, highlight the Kaju folder and Copy. Switch to your project and Paste.

[quote=196537:@Kem Tekinay]No.

Open you project in Xojo. Open the Kaju Admin project in Xojo. Now you have two projects side-by-side.

In the Kaju Admin project, highlight the Kaju folder and Copy. Switch to your project and Paste.[/quote]

Okay, just copied “Kaju Classes” into my project.
Add to your App instance the property UpdateInitiater As Kaju.UpdateInitiater.

how to run the kaju admin app thru included project? Do you mean run the other xojo instance, which opened previously?

The Kaju download includes an Admin app project that you can open and build or just open and run. That’s all that means.

Bear with me, I run the Kaju admin app, set up a new version by click the “+” at lower left corner, set up the software name and etc.
Copied RSA public key, export the htm file.

Then I put following code in my project main window open event handlers,

Dim u as new Kaju.UpdateChecker( SpecialFolder.Documents) u.ServerPublicRSAKey = "3082nnnnnnnn..." u.UpdateURL = "http://extranet.dummy.com/myupdate/kaju/updatetest.htm" u.Execute

I put the new generated htm file and a dumy zip file on the server.

Then I run my project, nothing happens. Do I miss anything? Any idea?

u will have a result after Execute. What is it?

No update available = 0