Hi, I'm trying to do a server.
I'm having trouble with the sockets:
public void run() {
while(XThread.Delay(m_threadIntervall)) {
System.out.println("trying to connect");
try {
m_acceptSelector.select();
} catch(IOException e) {
System.out.println(e.toString());
}
}
}
the m_acceptSelector.select(); doesn't throw any exception but the thread hangs up with that call and so does the rest of my application.
and if I have:
public void run() {
while(XThread.Delay(m_threadIntervall)) {
System.out.println("trying to connect");
}
}
Then the thread works just fine, but the rest of my application stops running?
I'm having something like this:
//create a JFrame...
MyJFrame() {
thread.run();
this.setVisible(true);
}
So when I comment away thread.run(), the application continues and the window
pops up.
But now the thread runs all the time and the window never pops up.
public class XThread extends Thread {
public static boolean Delay(long millisecDelay) {
if(interrupted()) {
return false;
}
try {
sleep(millisecDelay);
} catch (InterruptedException e) {
return false;
}
return true;
}
}
Would appreciate any help on this, thx !