Subject | Re: timeout a pending connection via a bad network? |
---|---|
Author | Adam |
Post date | 2005-12-18T21:36:03Z |
> Thank you, however, it can only tell me the responsetime, if any. Now Ilong,
> can decide, just before starting a connection: 'Ping is taking too
> better try again later'. But this can only be used to determine wetherDelphi handles most messages from within the main thread. I do not
> to start a connection or not.
>
> Suppose the network is good, I start my ACTION (connect to FB server,
> start a transaction, do something, commit or rollback, disconnect).
>
> Just before starting the ACTION, I start a timer in another thread.
>
> I keep monitoring this timerthread and some flag that indicates that
> ACTION should have been finished. At a certain time I might find:
> 'ACTION is taking too long, something obviously went wrong, something
> that apparantly does not trigger any errors or timeouts in the NOS, the
> sockets, the API, my IBObjects, my application. I want to, I even must
> abort'.
know enough about IBOs internal implementation and whether it performs
its operations inside the main thread or a separate thread, I assume
it probably goes the simple route.
>But is the main thread doing the "reaching", or is the main thread
> Same thing on explorer, mozilla or whatever browser. It can and will
> tell me if a server can be reached, it can tell me if there are errors
> in the pages etc etc.
simply waiting a predefined number of seconds before terminating a
worker thread which hasn't responded in a timely fashion?
But it happens quite frequently that NO errors are
> triggered, that a message 'loading data from xxxx' is displayed on thedon't
> statusbar and that some animated gif shows me the waiting state of the
> browser. But there IS a button to interrupt/abort the process! You
> need taskmanager to kill the application...It depends on your definition of a bad connection. If you decided that
>
> And that is my simple question. How to abort gracefully a bad
> connection? Can it be done?
the connection was bad because it was too slow to respond, but wasn't
so bad that the connection was dropped, then you could disconnect the
normal way, rolling back the transaction in the process.
If you mean that the connection is so poor that you are unable to
manage any comms, then you can not do a graceful disconnection.
If not gracefully, would it be possible and
> safe (and how?) to use something like IB_Connection.Forcedisconnect?thread?
> Would it be responsive or would it be busy and trapped in its own
Unless it creates its own comms thread, then the main thread will be
tied up waiting for the response. and will have to wait until the
operation fails before processing the ForceDisconnect. A bit of irony
there I suppose, unless the connection responds, you can not cancel
it. If IBO creates a comms thread, then IBO could indeed kill that
thread if it received a ForceDisconnect etc.
Of course there is nothing stopping you from running your queries from
a separate thread and synchronising when you get the result.
Adam