URLConnection.SendSync Issue

Hey all,

I’m seeing an issue with sending a command similar to this:

Dim result As String = h.sendsync("GET","http://"+IPAddress+"/cgi-bin/api/details/device/firmware/update",30)

As far as I know, the timeout (which I have as 30) should be in seconds. Yet I’m seeing what appears to be a timeout happening with varying different amounts of time from less than a second to maybe 3 or 4 seconds or more. But certainly nowhere near 30 seconds. I also boosted the timeout value up to something ridiculous like 3000000 and I got the exact same results.

I believe I am timing out because the “result” string is blank. I can load the same URL in an browser and I get data every time but it may take 7 or 8 seconds to return it. I sometimes get successful data back. It is inconsistent. I also had my device rebooting and so there would be no connection during the time the device is rebooting, so the SendSync command should definitely wait. But it wasn’t. It was returning a blank string after a couple seconds even though the device it was trying to connect to was temporarily offline.

I need to do it synchronously because I am updating a progress bar on a page and basically run the method that uses this from a timer fires 3 seconds after the method completes. I create the URLConnection in the method. So having to wait for an event doesn’t really work.

Am I doing something wrong or is there an issue with synchronous URL connections.

Check out Feedback 54410… It is probably your issue.

Yup. That’s it. Looks like it’s fixed in 2019R1 but I don’t see that in the PreRelease section of the forums yet so I guess I’ll have to limp along until we have something to test.