Xojo.Net.HTTPSocket timeout

I am trying to use the new Xojo.Net.HTTPSocket for a long-lived HTTP connection. The server can respond after 55 seconds. However, after trying it out, it looks like the HTTPSocket Error event will be raised with a reason of “The operation has timed out” after only 30 seconds. Looking at the documentation, I don’t see a way to adjust that timeout. The old socket had a parameter for timeout that you could set, but for various reasons I cannot use the classic framework socket. Is there something I can do here?

Not yet. <https://xojo.com/issue/38141>

I also sorely need this, more for reducing it to 1 second. I have HTTP poll requests that check to see if servers are alive, if not, the app needs to give up quickly.

That you could probably do with the old HTTPSocket though.

Problem is in classic HTTPSocket timeout can only be set in synchronous mode. For long response times that can be an issue. Does it not freeze the UI ?

If he’s wanting a timeout if 1 second, setting yield to true and calling it synchronously will probably work just fine.

Hi Greg and Michael, thanks for your replies.

My calls using the classic framework, with yield and running synchronously, were creating a very laggy UI when the servers they are talking to are not responding. This was within a timer. I was also getting occasional SIGEXEC crashes, pointing to HTTP issues. I was hoping by switching the high speed, regular calls to the new framework and running async, I might get more response and stability.

Many thanks,

James

[quote=274294:@James Cooksey]Hi Greg and Michael, thanks for your replies.

My calls using the classic framework, with yield and running synchronously, were creating a very laggy UI when the servers they are talking to are not responding. This was within a timer. I was also getting occasional SIGEXEC crashes, pointing to HTTP issues. I was hoping by switching the high speed, regular calls to the new framework and running async, I might get more response and stability.

Many thanks,

James[/quote]
FYI - Timeout is for how quickly the server allows a connection, not how quickly it responds. In today’s world that could take a really long time as http servers allow connections that they’ll sometime in the future respond to. It’s called “long polling”.