Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 12 total
Thread Connection Time Out
Tue, Oct 13 2015 6:37 PMPermanent Link

Jeff Cook

Aspect Systems Ltd

Avatar

Hi

Is there a way to alter the "time out" period when logging onto a remote
server?

I'm trying to handle the situation where a EDB server is not available
for some reason.

I have code that works OK but has delays.  The client tries to log on to
the server and if that fails, attempts to contact a fall back server.

If the server is on the LAN, there is virtually no delay - you know
instantly that the server isn't available.

If the server is on the internet, then there is a delay of approx 20
seconds before you get the exception.  A successful internet connection
happens so quickly that you can't time it.

I have created a dud session (invented an IP number) in EDBMgr to do the
same thing and after the 20 seconds delay I get:-

---------------------------
ElevateDB Manager
---------------------------
ElevateDB Error #1100 A connection to the server at '112.109.87.36'
cannot be established ('Socket error: A connection attempt failed
because the connected party did not properly respond after a period of
time, or established connection failed because connected host has failed
to respond.

 (10060), on API 'connect'')
---------------------------
OK
---------------------------

Is there a timeout property that I should be setting in the session to
get a quicker response?

There is a RemoteTimeout property in the EDBSession that looks like the
right thing, but I have left it as the default 180 seconds and the
connection certainly isn't waiting for 3 minutes!

Any help appreciated.

TIA

Cheers

Jeff
Tue, Oct 13 2015 6:53 PMPermanent Link

Jeff Cook

Aspect Systems Ltd

Avatar

On 14/10/2015 11:37 a.m., Jeff Cook wrote:
> Hi
>
> Is there a way to alter the "time out" period when logging onto a remote
> server?
>

Further to original post,  I have just played around with the
RemoteTimeout property and it didn't make any difference, good or bad,
to the delay.

Cheers

Jeff
Wed, Oct 14 2015 2:49 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Jeff


What about the OnRemoteTimeout event - never used it but it looks hopeful

Roy Lambert
Wed, Oct 14 2015 4:03 AMPermanent Link

Matthew Jones

Jeff Cook wrote:

> If the server is on the internet, then there is a delay of approx 20
> seconds before you get the exception.

That's just how long the internet waits for a connection to fail. I
doubt there is anything anyone can do, other than make the connection
in the background...

--

Matthew Jones
Wed, Oct 14 2015 4:30 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Jeff


Thinking about it some more a lot will depend on why the server isn't available. If you have an IP address and it responds to pings then it might be worth doing a ping first just to see if there's a response. At worst you should have  a couple of hundred milliseconds before a ping response. If the server isn't available due to to many connections or something like that you just have to wait for it.

I use synapse and setting up a pin is easy - it should also be easy in Indy.

Roy Lambert
Wed, Oct 14 2015 8:34 AMPermanent Link

Raul

Team Elevate Team Elevate

On 10/13/2015 6:37 PM, Jeff Cook wrote:
> Is there a way to alter the "time out" period when logging onto a remote
> server?

AFAIK such a timeout is not surfaced at this time.


> I'm trying to handle the situation where a EDB server is not available
> for some reason.

It will take some time to determine whether connection is available -
quickest response is if server is running, next quickest is if OS is
running but EDBSRvr is not (meaning server can tell us nothing is on
port) and slowest is if IP stack has to time out trying to reach the server.

There is not much you can do about the timeout today but if you want
more responsiveness then do a connection on a background thread (so it's
non-blocking) and if you want can even do it for both servers
concurrently so you then know which one is online.


> There is a RemoteTimeout property in the EDBSession that looks like the
> right thing, but I have left it as the default 180 seconds and the
> connection certainly isn't waiting for 3 minutes!

No - this one is the timeout for the client waiting on server to
complete a task (meaning you need to be connected already) - for example
this timeout could be triggered if server were running a really long
query or some other such operation. There is an associated
OnRemoteTimeout event as well so you can act on it.

Raul
Wed, Oct 14 2015 11:03 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Raul


>There is not much you can do about the timeout today but if you want
>more responsiveness then do a connection on a background thread (so it's
>non-blocking) and if you want can even do it for both servers
>concurrently so you then know which one is online.

I misunderstood what Jeff was looking for originally, I think I've got it right after Matthew's post but I don't see how trying to make the connection in the background is going to help.

I'm coming from a view that its a database app and there's not much you can do until the database is there and ready. If there is - great get on and do it - if not the app will be more responsive at doing nothing much <vbg>

Having said that I like your idea of trying to connect to both at once, not sure how you'd go about it and not sure if Jeff only wants people to go to server 2 if server 1 is down.

Roy Lambert
Wed, Oct 14 2015 11:43 AMPermanent Link

Raul

Team Elevate Team Elevate

On 10/14/2015 11:03 AM, Roy Lambert wrote:
> I misunderstood what Jeff was looking for originally, I think I've got it right after Matthew's post but I don't see how trying to make the connection in the background is going to help.

This would allow you to do a nice little connection progress or such in
your app - instead of just freezing the app and not being able to update it.

> Having said that I like your idea of trying to connect to both at once, not sure how you'd go about it and not sure if Jeff only wants people to go to server 2 if server 1 is down.

My approach is to have a generic thread which takes remote connection
parameters in its constructor (ip, port, login) and then start 2 of
these from main thread with appropriate IPs for each server. The thread
really just does a connection and can even disconnect then (unless you
want to do a query or check for store contents or such to make sure it's
a legit server etc).

Main thread can then show a "connecting ..." progress dialog while
threads start running.

Assuming one of those threads connects to a live server you will know
which is live in a few seconds and can then dismiss the progress and
open a db session from main thread and move on.


Alternatively if both fail to connect then you can get rid of progress
again and just tell user that network is down.

It's s all about whether you want to block the main thread or not during
this - there is no right/wrong answer really.


Raul



Wed, Oct 14 2015 12:52 PMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Raul


>This would allow you to do a nice little connection progress or such in
>your app - instead of just freezing the app and not being able to update it.

Ahh. I wrote a "distractor" component for this sort of thing

You have a nice approach there. I still think I'd ping it first, but you are right - no one way for all.

Roy Lambert
Wed, Oct 14 2015 1:43 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Jeff,

<< Is there a way to alter the "time out" period when logging onto a remote server? >>

Not currently, no.

Tim Young
Elevate Software
www.elevatesoft.com
Page 1 of 2Next Page »
Jump to Page:  1 2
Image