RTC Forums

Subscription => Support => Topic started by: ISIGest on March 26, 2015, 10:18:32 AM



Title: Connection Timeout on Android
Post by: ISIGest on March 26, 2015, 10:18:32 AM
How can I specific the connection timeout on Android?


Title: Re: Connection Timeout on Android
Post by: D.Tkalcec (RTC) on March 26, 2015, 12:16:58 PM
Blocking sockets API for Android (used for TCP/IP communication by RTC) does NOT have options for manually setting a connection timeout. Only sending and receiving timeouts can be configured by using the TimeoutsOfAPI ReceiveTimeout and SendTimeout properties on the TRtcHttpClient component.

Best Regards,
Danijel Tkalcec


Title: Re: Connection Timeout on Android
Post by: ISIGest on March 27, 2015, 08:05:51 AM
Oh yes I've setted it but with an HttpCLient.AutoConnect := True the connection stay busy for a long time :(


Title: Re: Connection Timeout on Android
Post by: D.Tkalcec (RTC) on March 27, 2015, 08:17:50 AM
Unfortunately, the time it takes for a connection to get opened is not under our control and the connect timeout period is controlled at the OS level, but I don't think a long timeout should be an issue. The problem would be if you would use too short timeouts, which would interrupt the connection process before it had enough time to get completed. Please note that mobile devices are usually working through mobile networks with high latency, because of which the time it takes for a connection to get opened will usually be much longer than on desktop machines, so the timeout values set up at the OS level will also be higher by default than on desktop machines.

Best Regards,
Danijel Tkalcec


Title: Re: Connection Timeout on Android
Post by: ISIGest on March 27, 2015, 09:08:48 AM
The only method is to manage a custom CallFunction method of TModuleClient that start a TTimer to check connection state.
If when TTimer is fired the HTTPClient property IsConnecting is true then I call DisconnectNow(True) method.
Thanks