Products

Price/Order

Support

Partners

Testimonials

Test Results

About us

Contact
 Detecting Connections.
Bottom
 
Total posts: 5
 Author Detecting Connections.
Steve Gill

25.11.2006 09:17:24
Registered user
I have an application using a TRtcHTTPClient connecting to an ISAPI RTC server.  What's the best way to determine if the client application has successfully connected to the server application?  

At the moment I'm calling a remote function on the server but getting no response in any of the TRtcHTTPClient events (eg. OnConnectError, OnConnectFail, OnResponseDone, OnResponseReject) and the client app is just sitting there (the TRtcResult's OnReturn event is not firing).  I have even tried entering an invalid URL and the client doesn't report any errors.

Using Delphi 7 and RTC SDK 2.28.

Thanks.

Regards,

Steve
Danijel Tkalcec [RTC]

25.11.2006 12:45:51
Registered user
One very important thing (which you didn't mention) is that you need to (1) set the ReconnectOn properties to re-open a connection if it failes or gets lost (ConnectFail, ConnectLost) and (2) either call "Connect" once on the start of your application to keep the connection re-opening every time it gets lost, or set AutoConnect to TRUE and let the RTC SDK handle opening and closing of the connections.

Setting AutoConnect to True and not explicitly calling "Connect" is a better solution, since then connections won't be forced to stay open when they are not required (nothing to send or receive).

Then ...

When using remote functions (rtcClientModule and rtcResult), you will get the the ResultAborted event on the TRtcResult component and OnResponseAborted event on the TRtcClientModule component in case your function call didn't succeed (for whatever reason). All other events are irrelevant.

When using the RtcDataRequest component, you will get the OnResponseAborted event in case your request was aborted and will not be reposted.

You can specify how often you want your request to be automaticaly reposted by using the AutoRepost property (rtcDataRequest and rtcClientModule). After this limit exceeded and your Client was still unable to complete the request, you will get the OnResponseAborted/ResultAborted event.

You can also set AutoRepost to -1, in which case your requests would be reposted unlimited number of times, until they succeed.

The idea is that for all your remote function calls, you just need to handle the 2 events on the TRtcResult component: OnResult if you get a result from the server, or ResultAborted if the request didn't go through properly. No other events have to be implemented for handling results from remote function calls.

Best Regards,
Danijel Tkalcec
Ron Levy

30.11.2006 19:30:27
Registered user
I seem to be having some problems with a HTTP client talking to an ISAPI server for a remote function (no issues what so ever when talking to a stand alone server application with a HTTP server.

My client sets the connection address using the following:


procedure TAccessModule.SetConnection(const sAddr: String; sPort: integer);
begin
   RegHTTPClient.Disconnect;
   RegHTTPClient.ServerAddr := sAddr + '/RegMgr/RegMgrApp.dll';
   RegHTTPClient.ServerPort := IntToStr(sPort);
   Log.Add('>Connecting to ' + RegHTTPClient.ServerAddr);
   RegHTTPClient.Connect();
end;


The HTTP Client control also has an OnException event handler. I call this function with sAddr = 'localhost' and sPort = 80 (I am still in debugging mode, obviously once it works and installs on my real server - it will be changed).

In the OnConnect I get the response that the client connected - but when I try to call a remote function I get an exception "Error Reading a Response Header (Code #12007)"

In the server I send a CodeSite message when the OnClientConnect event fires. It is interesting to note that I never see this happening when the client application tries to access it. But - if I manually navigate to the url http://localhost/RegMgr/RegMgrApp.dll from the browser - I can see the message in the CodeSite log (and get a 500 response in the browser - which is OK).

Any ideas what could be wrong - it seems that for some reason - despite being told that the client connected on the client side - nothing is seen on the server side.
Danijel Tkalcec [RTC]

30.11.2006 19:45:10
Registered user
You are doing two things wrong:

1) Your "rtcHttpClient.ServerAddr" is wrong.

ServerAddr has to be *only* the IP Address or Domain name of your Server, but you have appended the complete path to your ISAPI dll. If your Server is running on "localhost", then your ServerAddr has to be "localhost" - even if your are accessing an ISAPI on that Server.

2) What you have added after "rtcHttpClient.ServerAddr", should have been before "rtcClientModule.ModuleFileName".

The only thing changing when you are accessing your application running as an ISAPI is the "FileName" under which the "Module" is accessible. Server Address stays the same.

For example, if your Server is running at "localhost" on port 80, your ISAPI dll is accessible under "http://localhost/isapis/myisapi.dll" and you have set the "ModuleFileName" on your rtcServerModule (Server component) to "/mymodule", the *only* correct settings for your rtcHttpClient and rtcClientModule components are ...

rtcHttpClient.ServerAddr := 'localhost';
rtcHttpClient.ServerPort := '80';
rtcClientModule.ModuleFileName := '/isapis/myisapi.dll/mymodule';

That's it.

Best Regards,
Danijel Tkalcec
Ron Levy

30.11.2006 20:09:08
Registered user
Thanks. Sounds good. I will give it a try a little later and suspect it will work just fine.