Home › Forums › Syphon › Syphon Development – Developer › getting list of servers › Reply To: Reply To: getting list of servers
I added this code to listServers():
ArrayList tempList = null;
int size0 = 0;
int count = 0;
for (int i = 0; i < 50; i++) {
try {
Thread.sleep(10);
} catch (InterruptedException e) {
e.printStackTrace();
}
tempList = JSyphonServerList.getList();
if (tempList.size() == size0) {
count++;
}
size0 = tempList.size();
if (10 < count) {
break;
}
}
it is not pretty, but works. However, the numbers (10ms, 50 tot attempts, etc) are basically arbitrary guesses. Also, if there are many servers, the 10 < count condition might not be enough. So I wonder if there is a better way to do this.