URLConnection to self fails on Windows

I have a Xojo 2023R4 WebApp that has a browser Session send a URLConnection with some text to itself (at 127.0.0.1 or its IP address) which encrypts the string and sends it back to the browser.

It works on macOS in both Debug mode and as a compiled app on macOS, but it fails in all three of: Windows Parallels VM in debug mode, Windows Parallels VM as compiled app, and on my Windows host server in compiled mode.

In each case the WebApp runs in the browser OK and the button sends the URLCommand (port 11000, I have tried others), but no HandleURL Event is received and it eventually times out with no response.

Any clues on what I should try next?

Is Windows Firewall blocking it? Try adding a rule allowing your port. Or disable the firewall (just for testing.)

1 Like

Thanks @Eric_Bloom, but in the end it was not a Windows firewall issue.

It turns out that while a macOS WebApp can perform a URLConnection.SendSync() on itself, Windows cannot. Windows can only perform a URLConnection.Send() on itself.

1 Like

Nope. Windows doesn’t work with URLConnection.Send() on itself either, but returns an error #12152 ‘Error occurred while receiving response from server’. With SendSync() the URLConnection freezes, with Send() it returns an error (despite HandleURL adding the sample text to the WebResponse). Firewall on or off makes no difference.

I have adapted the Xojo example ‘Using GET with URLConnection’ as a Web App to try to show this (http://www.holymackerelsoftware.com/Downloads/UsingGETWithURLConnection.xojo_binary_project.zip).

As I said, this works fine on macOS but fails to return the HandleURL text in Windows. Any clues on how to allow a WebApp to send a URLConnection to itself on Windows or do I need to raise a report?

I have created a report for this issue:

https://tracker.xojo.com/xojoinc/xojo/-/issues/74975

This thread should be on the Web channel, not Windows.

The title should reflect better the problem too, like:

URLConnection from a web app fails to talk to localhost (itself) on Windows

When I try your sync option I get error 12002, timeout. I guess it may be related to the fact of the Xojo app being busy waiting for response from itself, some kind of deadlock, as Xojo is not multi-threaded. It must be sending or receiving, not both in parallel, and Xojo Web for windows may be more sensible to this in any way.

I used Xojo 2023

Thanks for testing it @Rick_Araujo and for the suggestions — I’d change the Title, but it seems to be locked now.

Re Windows versus Web, ‘Windows’ doesn’t always imply a Desktop app. In this case the failure is only on a Windows WebApp (works fine on macOS), so could go in either category equally as Web or Windows, and since Windows is the only candidate of failure, I’ll let it stand.

I will be deploying on a Windows Server, so for me the Windows incompatibility is crucial. If Xojo prove it is a Web issue rather than a Windows issue, I’ll change it.