Xojo.Net.HTTPSocket

Dumb question. Is anyone using the new Xojo.Net.HTTPSocket class in cross platform applications? I develop on OS X and it works stellar there. In Linux it’s gives weird results and on Windows it seems to not work at all.

In Linux it appears that perhaps that SetRequestContent doesn’t work as it should since the data is never received by the web app. Well, the key is there but the value is always blank. Here’s the code

dim d as new xojo.Core.Dictionary d.value("Username") = "Bob" d.value("Password") = "Keeney" dim s as text = xojo.Data.GenerateJSON(d) dim data as xojo.Core.MemoryBlock = Xojo.core.TextEncoding.UTF8.ConvertTextToData(s) oSocket.SetRequestContent(data, "application/json") oSocket.Send("POST", sURL + "Login")

In Windows, the Send just goes into oblivion. No error message. No exceptions. Just…nothing.

Very frustrating to get such vastly differing results. Any ideas or observations on the new HTTPSocket??

Can’t test with application/json mimetype, but it’s work when sending form data. Tested in linux.

did you use a network traffic tool to check what is going though the network?

or use CURL Plugin as an alternative

I can’t on this project.

I submitted a private bug report. I narrowed it down (in Windows at least) to the xojo.net.httpsocket either being in a thread or being subclassed. In a much smaller, simpler project I was able to get a runtime error.

Either way it screws this project over. Waiting on client decision to go to old socket or to CURL.

Bob, please file a bug report about this…

Um…

:slight_smile:

Make him 6’10" and I’d look just like him. :stuck_out_tongue:

Timeout on Windows because Xojo.Net.HTTPSocket is dog slow…?
My FB case 40580 has been actively ignored but is keeping me off Xojo.Net.HTTPSocket.

Also see this thread: https://forum.xojo.com/27474-xojo-net-slowness-could-anyone-test-example-project-in-fb-case-/last

In the interim you can use https://github.com/1701software/GlueKit/tree/GlueKit-for-Xojo-2014-3.1

There is a GlueKitHTTPSocket in there that is a drop in replacement for Xojo.Net.HTTPSocket. It’s cross-target aware so on iOS it uses Xojo.Net.HTTPSocket and on Desktop/Console it uses HTTPSecureSocket. This way you don’t have to break everything relying on Xojo.Net.HTTPSocket and you can sub it out when the issue is resolved @ Xojo.

Ah. Thanks, Phillip. I might take a look at it. If I don’t have to break all my existing code I’d be a happier developer. :slight_smile:

So far, GlueKit to the rescue! More testing required but it worked right off the bat in Windows.

Great. I build and used it pretty extensively in a project that is both Desktop & iOS where all the business logic is shared between the two.

I just ran into this issue as well under Linux.

Easy to verify, just step thru the debugger in Linux, SetRequestContent will zero out datablk, but stepping thru in OS X produces the correct result.

[code] Using Xojo.Core
Using Xojo.Data
Using Xojo.Net

Dim json As Text
json = “[”“192.168.1.1"”]"

Dim datablk As MemoryBlock
datablk = TextEncoding.UTF8.ConvertTextToData(json)

Dim mySocket As New Xojo.Net.HTTPSocket

mySocket.SetRequestContent(datablk, “application/x-www-form-urlencoded”)
mySocket.Send(“PUT”, “http://192.168.1.100/PutIP”)[/code]