HTTPSocket use

Is there’s a difference between these two blocks of code ?

Dim socket1 As New HTTPSocket Dim data As String = socket1.Get("http://www.xojo.com/", 30)

Dim socket1 As New HTTPSocket Dim data As String data = socket1.Get("http://www.xojo.com/", 30)

It doesn’t look so. Are you getting different behavior?

the first has 2 Lines, the second has 3 Lines

The second looks faster (download faster than the first) even if I add a if block (in fact I wrote it that way because I had to use an If Block).

The first took ages to do the job…

tested in Linux

  1. 66 Ticks
  2. 65 Ticks

[quote=318018:@Emile Schwarz]The second looks faster (download faster than the first) even if I add a if block (in fact I wrote it that way because I had to use an If Block).

The first took ages to do the job…[/quote]
That sounds more like a dns resolution problem to me.

I was just curious. The first code comes from the documentation.

Explanation on how I went there:
I was lazy in using it “as is”. Worst, I prefer to use the second form (nicer in my eyes).

I was searching a reason of troubles (when downloadinf today’s files) and “found something” (beyond this question). I had to write the second one to be able to modify the .Get(URL, 30) (no date needed in the URL for today’s file):

// I have a If test about the URL date (if today, use the URL as is, else, append a date to the URL If <condition above> Then TheURL = "http://www.xojo.com/tips/" // Get the tip of the day (example) data = socket1.Get(TheURL, 30) Else TheURL = "http://www.xojo.com/tips/2017/02/26/" data = socket1.Get(TheURL, 30) End If

That said, I am not an expert in this domain. I let you know what I think I have found.