¿ªÔÆÌåÓý

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

Re: Impossible to reconnect after TWS restart, please help!


 

@btw give the best path:
you should start from a working example and increase complexity gradually. Splitting issues to do small studies set, one topic at a time,? then assemble what mastered from each study, minded with the principle "divide an conquer".

Opinion:
- your reconnect() method is either too complex or not enough, so make it simpler or remove the concept of reconnect().
If your connection is broken prematurely you cannot even assume that received messages are consistent, better throw away all of them.? BTW there are no reason your connection broke unless TWS restart which is a different issue.
- what you want to do need that you study the code in and around EReader, and see how to .join() it to be sure you never have more than 1 thread running it at same time.
disconnect() should be enough to exit the EReader thread by exiting the while loop, as long as it's not the case, you probably have a racing issue. and/or need to study isConnected()

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