¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: Need reconnect strategy (getting a little desparate)


 

--- In TWSAPI@..., Barnet Wagman <bw@...> wrote:
Here's what I'm currently doing:

When a EWrapper.connectionClosed() is received
- my app sleeps for 1 second.
- it thens calls ibSocket.eConnect(...), using the same client id as
the original connection; the client id is NOT zero.
Do you have any idea why EWrapper.connectionClosed() being called at
all? In the vast majority of cases the TWS / API connection is a local
socket connection which should be 100% reliable. If you read the source
for EReader, the only time that the connection is closed is when your
code throws an exception while processing a message. (The only other
call is EClientSocket.close()). That being said, I have seen cases where
a disconnect can cause TWS itself to throw an exception. The log file
will contain a stack trace that may help.

Join [email protected] to automatically receive all group messages.