D.Tkalcec (RTC)
|
|
« Reply #1 on: November 08, 2014, 08:24:52 PM » |
|
If you are manually calling "Connect" and "Disconnect" (not using AutoConnect=True), you can use the "isConnected" or "isConnecting" property to check the current status of the connection. But even if the isConnected property does return TRUE, it does not guarantee a success when posting a request, because (A) the connection could already be closed but the sockets API has not "noticed" it yet, or (B) the connection could be closed but the underlying API won't report that unless you actually try to send something through, or (C) the connection could drop while you are trying to send data through. So, the only sure way of knowing that a remote function call would succeed, is to try and make the call.
I'm not sure I understand your goal, but the simplest way to handle HTTP connections is to set the AutoConnect and ReconnectOn properties to TRUE on the TRtcHttpClient component, and set the AutoRepost property on the TRtcClientModule component to the number of retry attempts you find acceptable in case of connection failures. When you set AutoConnect and ReconnectOn properties to TRUE, if a connection is not open when you make a remote function call, the Client will try to open before trying to make the remote call. And if the AutoRepost property is used (not zero), a new remote function call attempt will be made in case of a failure, without raising the exception when you use the Execute method.
Best Regards, Danijel Tkalcec
|