How to recover from URLConnection.Error?

I found some prior postings, but am still stuck.

Once I get an error like this…
URLConnection.Error event: 7 Reason: Connection terminated unexpectedly
…then the URLConnection object seems hung, and continually things “A request is already in progress”.

Is there something bulletproof I can do in the URLConnection.Error event that will allow this exception to be addressed, and restore the URLConnection back into action?

I usually don’t reuse connection objects. I use a fresh one for every request.

I don’t know why I work so hard to recycle objects, it’s not like I’m reducing carbon emissions or anything meaningful. I’ll move this URLConnection into a perishable scope and see how things improve. Thanks Tim.

1 Like