Trouble using URLConnection on Rasoberry Pi

I am having trouble retrieving some info from our cloud server with

var url As New URLCOnnection
var a As String = “
var reply As String = url.SendSync(“GET”, a, 10)
The program hangs as soon as the last line executes in the remote debugger with no error messages in the terminal. When I copy the a string into a browser, it returns a JSON string. If I run the program in the Windows debugger, it executes properly.

When i set

a = “

I get a reply when the last line executes in the remote debugger.

I use URLConnections in several other places. One simply gets the internet IP from That one worked the first time, but not again. There is also another one that sends data to the server for storage. It hangs with both GET and POST methods on the rPi, but works with Windows.

libunwind9 and libsoup2.4 are both installed. Using Xojo 2022r1.1 as a web app that reads meters in the app and has a webpage for displaying readings to the user.

Possibly related?

Edit: Ah, no. That’s your thread and you say it’s working elsewhere. Disregard.

Did you mean to have a space at the end of the URL? Does removing it help? I’ve never tried adding arbitrary characters to URLs.

Yeah, I’m betting on that space. I just tried to access a URL with a trailing space using URLConnection on my Mac and get an InvalidArgumentException with “Request url is not well-formed.”

The code actually has a variable instead of the number with the space at the end. I copied the URL from my browser and somehow included a space. The space is not sent. There is also a space shown in the URL in my post above and that one works.

If you launch your debug build on the Pi from the command line, do you get any error messages back in the console when the SendSync fails?

No. It just says it is launching the app. The web page never appears. When I stop the debugger, there is a line saying it was launched, then three lines

connection Closed

Something was apparently missing in the OS. I had run sudo apt-get update before starting. After running sudo apt-get upgrade, the issue no longer happens.

1 Like