I have a call to a remote Datasnap REST method where the server sometimes doesn't respond and I need to detect it and terminate the application instead of leaving it frozen.
I use a DSRestConnection, and a Datasnap REST Client Module where all the remote methods are defined, attached to the DSRestConnection. I can't find a Timeout property on them, AFAIK I can only set Timeouts on the Datasnap Server, but sometimes the client loses connection to the server, so I also need to raise a Timeout on the client.
How can I emulate a Timeout when I don't have one ?. Is there a class to help do that or do I need to code it from the ground up ?. in this case, the way to go is to do the remote call on a secondary threat, so the main thread is still responsive and use something like a Timer to check if the call has succeeded in time ?.
I would appreciate any suggestion. Thank you.
The TDSRestConnection
should give you access to the underlying TDSHTTP
client via its HTTP property. The TDSHTTP
client exposes a ConnectTimeout and a ReadTimeout property. Perhaps the latter one is what you are looking for.