RTC Forums
November 24, 2024, 01:13:34 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: Blocking calls and timeout  (Read 6244 times)
thomh
RTC License+
****
Posts: 17


« on: June 11, 2014, 03:31:05 PM »

Hi, I have a client that uses blocking calls exclusively using:

RtcClientModule1.Prepare('SomeProc');
RtcClientModule1.Param.asString['BndNo']:=1;
RtcClientModule1.Execute;

Some of these calls can take a long time to finish and I notice that after about 2 minutes there is a timeout somewhere and the client looses its session on the server.

I have set the session KeepAlive to 10 minutes.

Is there something I need to set on the client in order to accommodate for these long waits?

Thanks.

// Thom
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 on: June 11, 2014, 04:11:27 PM »

Sessions expire on the Server only if they have NOT been used for a set period of time. When using RTC remote functions with AutoSessions (for example, when using RTC encryption), that period is defined by setting the AutoSessionsLive property on the TRtcServerModule component on the Server. If you manually create and open Sessions on the Server, you will define the timeout period using the Session.KeepAlive property. For Session expiration, there are no other timeout values. If a Session expires, it means that the Client did not contact the Server to access the Session for at least the period you have defined as your Session timeout.

Best Regards,
Danijel Tkalcec
Logged
thomh
RTC License+
****
Posts: 17


« Reply #2 on: June 11, 2014, 07:08:12 PM »

Thanks, Danijel.

One more question. I want to use AutoSessionPing property on the client. In the OnPing event I notice that in other posts you have said to use something like this:

procedure TCLientConnectionModule.ClientModulePing(Sender: TRtcConnection;
  Data: TRtcValue);
begin
  Data.NewFunction('Ping');
end;

In all my other calls I first set the ClientModule.ModuleFileName equal to the ServerModule.ModuleFileName, f.ex. '/SYS'

How would I set this ModuleFileName in the event above?

Thanks again.

// Thom
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #3 on: June 11, 2014, 09:34:05 PM »

There is only one ModuleFileName property on the TRtcClientModule component, which is used for the PING as well as all other remote function calls sent from that TRtcClientModule component. Each TRtcClientModule component on the Client side is linked to only one TRtcServerModule component on the Server side and you should NOT try to change the ModuleFileName property on-the-fly. In short, the PING function on the Server has to be linked to the same TRtcServerModule component which you are using for all other remote functions which sent from that TRtcClientModule component.

Best Regards,
Danijel Tkalcec
Logged
thomh
RTC License+
****
Posts: 17


« Reply #4 on: June 12, 2014, 07:57:29 AM »

Ah, I have been using one ClientModule and to call 10 different ServerModules using:

RtcClientModule1.ModuleFileName := '/LOGIN';
RtcClientModule1.Prepare('SomeProc');
.....
RtcClientModule1.ModuleFileName := '/DOCS';
RtcClientModule1.Prepare('SomeProc');

I have around 400 server methods the client calls that are divided between 10 different TDataModules each with one TRtcServerModule component.
What you are saying is that I also need 10 separate TRtcClientModules linked to each of these ServerModules.

But this means that a new session is created for each of these TRtcClient/SeverModules as well, correct?

Can session data be shared between TRtcServerModules?

The way the rest of the server is coded I need one instance of session data pr. client connection. What do you recommend as the most practical way to code these 400 server methods?

// Thom
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #5 on: June 12, 2014, 09:09:09 AM »

Client-side Sessions are stored in TRtcHttpClient components. You can have as many TRtcClientModule components as you want, all linked to a single TRtcHttpClient component and sharing the same Session ID on the Server. The same way you have grouped your functions on the Server by using different TRtcServerModule components, you can group your methods on the Client for calling those functions by using separete TRtcClientModule components.

It is enough for one of those TRtcClientModule components to have a PING implemented in order for the Session to be kept alive on the Server. No matter which TRtcClientModule you use to make a call to the Server, as long as it is using the same TRtcHttpClient component, it will be using the same Session ID and keep the Session alive on the Server.

Best Regards,
Danijel Tkalcec
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #6 on: June 12, 2014, 09:15:16 AM »

Anyway ... before you start completely organizing your Client, if you say that everything is working the way you are using it now, I would recommend you to add a new TRtcClientModule to the Client and a new TRtcServerModule to the Server for the PING calls. As long as the TRtcClientModule component is linked to the same TRtcHttpClient component, that PING will be keeping the Session alive.

By the way ... your implementation with changing the ModuleFileName on-the-fly is working only because you are exclusively using blocking calls, or because you are not using RTC encryption. With non-blocking calls and RTC encryption enabled, you would get in trouble if you would be dinamically changing the ModuleFileName property before each remote function call.

Best Regards,
Danijel Tkalcec
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.026 seconds with 17 queries.