|
Attention! Read the forum rules carefully before posting a topic.
Submit JForex API bug reports in this forum only. Submit Converter issues in Converter Issues. Off topics are strictly forbidden.
Any topics which do not satisfy these rules will be deleted.
reconnect() / connect() issue |
ftasso
|
Post subject: reconnect() / connect() issue |
Post rating: 0
|
Posted: Thu 12 Aug, 2021, 15:14
|
|
User rating: 2
Joined: Fri 27 Jul, 2018, 13:46 Posts: 14 Location: ItalyItaly
|
Hello Support, I have problem during connection lost. I checked my code many times and I didn't found any difference then the implementation suggested in the SDK. Sometimes connection is recovered within the 3 tryes made by calling reconnect(), after this phase I call the connect() routine and starts a infinite loop without have a recovered connection. This accours using both demo and real account. Please take a look at the attached log
Attachments: |
JForex_connection_problem.xlsx [74.51 KiB]
Downloaded 791 times
|
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on
this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control
on their content. Anyone accessing this webpage and downloading or otherwise making use of any document,
data or information found on this webpage shall do it on his/her own risks without any recourse against
Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from
the use and/or reliance on any document, data or information found on this webpage.
|
|
|
|
|
|
ftasso
|
Post subject: Re: reconnect() / connect() issue |
Post rating: 0
|
Posted: Mon 13 Sep, 2021, 10:22
|
|
User rating: 2
Joined: Fri 27 Jul, 2018, 13:46 Posts: 14 Location: ItalyItaly
|
Hello Support, can you please suggest something? I still have the problem.
Thank you, Fabrizio
|
|
|
|
|
API Support
|
Post subject: Re: reconnect() / connect() issue |
Post rating: 0
|
Posted: Mon 27 Sep, 2021, 14:09
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
Greetings.
Do you have delay between connection attempts? Looks like authorization is failed because of previous disconnect request.
private static void tryToReconnect() { Runnable runnable = new Runnable() { @Override public void run() { if (lightReconnects > 0) { client.reconnect(); --lightReconnects; } else { do { try { Thread.sleep(60 * 1000); } catch (InterruptedException e) { } try { if(client.isConnected()) { break; } client.connect(jnlpUrl, userName, password); } catch (Exception e) { LOGGER.error(e.getMessage(), e); } } while (!client.isConnected()); } } }; new Thread(runnable).start(); }
Regards.
|
|
|
|
|
ftasso
|
Post subject: Re: reconnect() / connect() issue |
Post rating: 0
|
Posted: Tue 28 Sep, 2021, 11:02
|
|
User rating: 2
Joined: Fri 27 Jul, 2018, 13:46 Posts: 14 Location: ItalyItaly
|
Hello, I found the problem. My application have two client instances, the first is IClient and the second is ITesterClient: IClient for running my strategies and ITesterClient for test. I don't know if this is a correct practice. Anyway the anomalous reconnection appear if I have connected the IClient instance (the first instance started) and not the ITesterClient instance (this make connection only at the first backtesting). In this case works only the IClient.reconnect() call then the IClient.connect() fails with the reason AUTHORIZATION_FAILED.
Regards, Fabrizio
|
|
|
|
|
|
Pages: [
1
]
|
|
|
|
|