HTTPSocket.Get Trouble

For an updater, I want to download new versions of my app with a httpSocket. Therefore I have dragged a httpSocket onto my update window. A button calls:

f=SpecialFolder.UserHome.Child("Downloads").Child("Goldfish_4-0_Macintosh.dmg") If f<>Nil Then DownloadSocket.Get "", f End If

With click on the button, a file named “Goldfish_4-0_Macintosh.dmg” is created in downloads. But no download begins. The file remains empty and no event from the httpSocket is called. No Connected, no Error, no ReceiveProgress, no DownloadComplete. Did I do something wrong? I just want to download the file “” to the “Downloads”-folder.

You can check a demo project here. It contains only a button that starts the download. And the code “Beep” with a Breakpoint in all available httpSocket events to check if they get called.

I removed the double post

Have you looked at the Kaju updater framework that Kem posted ?

Look here :

Thank you. :slight_smile: The kaju updater framework is nice but I can’t use it without much modifications. And it does not explain why

DownloadSocket.Get "", f

does not work. I use this code in all my Windows and Mac Carbon apps for years but it seems to be broken under Cocoa.

Patience seems to be required
Here it runs and I eventually got an error event with error code 22
I’m not sure why

It seems to be on a flaky server.

  1. On one attempt at a restart it gave me a 416 Requested Range not satisfiable, though it was and restarted again correctly several times.
  2. The connection keeps being dropped by the server, like badly. I canned it at about 20MB after 5 restarts.

Then, I finally got the file it was the wrong size.

Tried again, no drops, file correct size.

I’ve had sporadic results as well

Hmm, then you get better results than me. I never get any bytes downloaded and sometimes error 22 appears. Some web searching revealed:

Error 22 is “Invalid argument”.

I am not sure if the problem is on the web server. the code

ShowUrl ""

works always here and Safari downloads the file without trouble.

I tried the URL in Safari and got the file once and and error on another try

Came down OK on Firefox on PC.

I have found the problem.

My updater did not work because I used


to show the window on that the download socket is located. It seems that the code execution stop from .ShowModal prevents all events of httpSocket from being fired unless you call .Hide or .Close. Is this a Cocoa bug? I have altered my code so that I don’t need .ShowModal for that window anymore.

My demo project did not use .ShowModal for the window so that you could not reproduce this.