HTTPSocket Get Synch Slow on large file?

Hi all,

I’m running into a minor problem that I’m sure once again, it’s something I’m doing wrong.

Ok, I am attempting to load 2x chunks of json data from my website. The first json data is small, about 1K and loads really quickly, the other is fairly large (~140K) hits the timeout without loading anything. I know the link is correct since if I copy and paste it into a web browser, less then 1/2 second it’s all loaded and displayed. Here’s the hunk of code…

  Dim http As New HTTPSocket
  app.eventDataJSON  = http.Get("", 30)
  me.ContainerControl11.SplashDisplay.Visible = False
  me.DesktopMainMenu1.Visible = True

I’m not sure why it is timing out like it is instead of just loading the data…

put http:// in front of your url. With that it’s instantaneous here.

Odd, I had the http:// in front and had the same issue I’m currently having. I’ll have to do more research, it’s weird though that I can access the other json on the same server without a problem, it’s just the huge json file I can’t unless it’s some weird thing with running the app in debug mode on the linux client… I didn’t have the http:// initially due to the sample on this page: which showed it being used without the prefix…

I just also tried it in a desktop app with the same results, the only other thing I could imagine is a firewall issue, but with my being able to download another much smaller json from the same server, I’m not sure why it isn’t working with the larger one.

I managed to get it to work once on windows so far while at work. I am just not seeing why this code isn’t working for me. If I can open the link in a web browser without issue I’d imagine it should work within Xojo… Unless I’m running into some sort of buffer issue, but from the docs it appears the buffer should be about as much available RAM is in the system and the file is <140K

firewall issues ?

That was my first thought, but quickly dismissed because if it were firewall issues, I wouldn’t be able to pull the content down via a web browser and I wouldn’t also be able to pull the smaller JSON data down. My next thought was filtering at the firewall, so I checked the filters to make sure that the link and the data in the file hadn’t been flagged incorrectly and tar-pitted or just blocked. At home I had the same issue.

As I was getting ready to pull my hair out, I decided to take a chance on Async transfer. I subclassed the HTTPSocket class, ran it and BAM, it worked, first time, about 2 or 3 seconds to get the content. I don’t know why the sync transfer wouldn’t work (maybe a buffer issue?), but the async worked perfectly, so now I just have to do a little re-wiring to make sure the splash screen doesn’t go away until AFTER the data has been obtained :slight_smile: I was actually quite pleased, handling async in ios in the past has been such a pain with the delegates (and later blocks) - it was so easy to do here, I looked at the screen and was thrilled.

Hello, maybe this will help:

I had a similar issue with HTTPSocket and I tested it extensively with the following results:

  • HTTPSocket performs very well locally (requesting various sized pages from the server on localhost). I have taken it to over 8MB in under 2 secs, while 10 KB takes less that 0.02 secs.

  • Requesting pages of big sizes over the Internet from my home location also makes HTTPSocket to perform well, with no delays.

  • However, requesting a page from the LAN at work or over a VPN performs in 0.1 secs for page sizes under 8000 bytes. When requesting a page of 8001 or more, it adds about 5-6 secs of delay which stays relatively constant as size increases.

In view of facts above, I think that indeed there is a network/firewall issue configuration that has nothing to do with Xojo.

The only reasons I disagree are:

  • It worked perfectly with the async transfer - if it were a firewall issue, I should have experienced a similar result either way.

  • I tried it after completely disabling the firewall on the machine the app was running on with the same results.

The only other possibility is if there was something in the file itself that I was capturing (odd alt-code character perhaps?) that might have caused a problem with the transfer? But then again, it begs the question why would it work on async and not sync (unless they sync buffer code is very different then what is used in the async code)? There was a “special” non-printable character in two places in the file I later learned about when it crashed out during display of the data downloaded in a textarea (after dealing with the text in those two blocks, I haven’t had an issue with display of text), but still - why would it be able to be downloaded async and not sync if it were a character related issue

Out of curiosity, did you have the Yield property set to True or False?