Title: Calling remote functions in blocking mode Post by: Ronald van Tour on November 18, 2012, 11:51:20 AM In quickstart you can find topic "Calling remote functions in blocking mode « on: November 24, 2009, 06:50:39 PM » "
But is also possible to set property RTCHttpClient.Blocking. Can you explain the difference. Title: Re: Calling remote functions in blocking mode Post by: D.Tkalcec (RTC) on November 18, 2012, 12:27:00 PM Properties on the TRtcHttpClient component define which "socket" API you want to use for the communication. There are blocking and asynchronous socket APIs supported by the RTC SDK on Windows. On other operating systems only Blocking APIs are supported, but the RTC SDK will be emulating non-blocking behavior there by using background threads and automatically synchronizing all events with the main thread.
By setting the "Blocking" property on the TRtcHttpClient component to TRUE, you tell the component that you want to use a blocking API, even if there is the possibility to use Asynchronous communication. In that case, if you also leave the "MultiThreaded" property on FALSE, all the communication will be handled from the main thread in blocking mode. But if you set the "MultiThreaded" property to TRUE, all the communication will be happening in background threads (and thus be non-blocking) even if you are using a blocking sockets API. If you want to write your code in a Linear Blocking mode, and you want to make sure that your code works correctly even if your connection components are set up for non-blocking communication, or ...in case you need to do some things in blocking mode even though you prefer to use non-blocking event-driven communication, you can use the "Execute" method to make remote function calls in blocking mode, or use the "WaitForCompletion" method if you want to write events but still want to wait for all the requests to be completed (responses received and all the required events executed) before your function/procedure/method continues execution. WaitForCompletion method is available for general requests as well (TRtcDataRequest component) and not only for remote functions (TRtcClientModule component). Here are the properties which specify the API to be used: Blocking, useProxy, useWinHTTP, useSSL, CryptPlugin. If you want to see how these properties affect which connection provider (and thus - which underlying API) will be used, please check the "TRtcHttpClient.CreateProvider" method in the "rtcHttpCli.pas" unit. Best Regards, Danijel Tkalcec |