Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

How to break out connecting thread
 Post subject: How to break out connecting thread Post rating: 0   New post Posted: Fri 06 Feb, 2015, 02:14 

User rating: 0
Joined: Thu 15 Jan, 2015, 03:00
Posts: 8
Location: Vietnam, Da Nang
Hi all,
When my program run:
client.setSystemListener(new ISystemListener)
{...
....
....
}
client.connect(jnlp,user,pass);

Ex: I want if after 5seconds if client not connected, I want to cancel connecting, and login by another account.


 
 Post subject: Re: How to break out connecting thread Post rating: 0   New post Posted: Thu 19 Feb, 2015, 09:51 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
To wait for the client to connect you can use the following code

int i = 10;
while (i > 0 && !client.isConnected()) {
    Thread.sleep(1000);
    i--;
}


 

Jump to:  

cron
  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com