RTC Forums
May 02, 2024, 08:59:21 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: RtcFunction not executed  (Read 3524 times)
HelgeLange
RTC Expired
*
Posts: 100


« on: July 27, 2017, 04:12:34 PM »

Hi Danijel,

I have a strange problem on my server. While the code works fine on my Dev-PC, the same code compiled on the live server doesn't execute some of the RtcFunctions. But I'm even assigning them in code because Delphi sometimes "forgets" the connection if the datamodule with the RtcHttpServer and ServerModule is not loaded. I have only 1 HttpServer and ServerModule, it is strange that some function are executed, others not.

The question is if there is a way to see, what's registered as function ? like a list I can iterate and see, what's missing ? or some other idea where and how to look for the problem ?

Thanks in advance,
Helge
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 on: July 27, 2017, 04:40:20 PM »

TRtcFunctionGroup component has a FunctionExists method, which accepts the FunctionName as a parameter and returns TRUE if a function with that name is accessible through the component.

There are also BeforeExecure and AfterExecute events (same component), which can be used to log all function calls made through the component. The BeforeExecute event is called just before the actual remote function, while the AfterExecute event is called ONLY if the function finished without raising an Exception.

Another event you might want to check on the same component is OnWrongCall, which is executed in case a call is made for a function which is NOT accessible through the component. In other words, if a function call is received by a TRtcServerModule component which can NOT be found on the assigned TRtcFunctionGoup component, the OnWrongCall event will be triggered, so you can use the "Param" parameter from that event to check the name of the function being called (Param.FunctionName), as well as any parameters received for that function call.

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


« Reply #2 on: July 27, 2017, 05:32:20 PM »

By the way ... if a Client calls a remote function on the Server which can NOT be found (and was therefor NOT executed), the Server will send a Result back to the Client with an Exception message like "Function XYZ not found" (Result.isType = rtc_Exception; Result.asException = exception message).

If a Client does NOT get anything back from the Server after calling a remote function, your problem is most likely a disconnect, which could either happen while your Client was sending the remote function call to the Server, or waiting for a result from the Server. In that case (disconnect before a Result was received from the Server), the OnResponseAbort event should be triggered on the TRtcClientModule component on the Client, unless the component is configured to re-post remote function calls using the AutoRepost property or by implementing the OnRepostCheck event to repost only some function calls.

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.024 seconds with 17 queries.