HTTPSocket

I have this strange behaviour from even the most simple code that is ever made to the test!!
From the manual at http://documentation.xojo.com/index.php/HTTPSocket

Dim http As New HTTPSocket MsgBox(http.Get("www.xojo.com", 30))

My simple app, containing just some buttons, freeze … until maybe 30-45 seconds and then an empty MsgBox occur.
Other URL’s are (sometimes) faster and also provide the code for the page in the message…

What’s happening!? Why is there a delay for such a long time!?

It looks like way too much information to stuff into a msgbox. The example shows the data going in to a string variable. I would try that first and see how long it takes.

hmm, wierd. Works here :slight_smile:
As Joseph suggested. Try:

Dim http As New HTTPSocket Dim s as String = http.Get("www.xojo.com", 30) MsgBox s

Use http.Yield = True, to not freeze the GUI thread.

Also, you should check the HTTP.PageHeaders and the HTTPStatus that are received, since you may receive a redirect status (301 or 302).

Yea, it’s working… But it sure aint fast!
But at the other hand, maybe it’s Google that don’t enjoy automatic requests…!

[code]
DIM http as New HTTPSocket
http.Yield = TRUE

DIM strSearchString as String = “http://www.google.se/search?hl=sv&q=” + encodeURLComponent( txtSearch.text )

DIM tmp as String = http.Get(strSearchString , 30)
TextArea1.text = tmp[/code]