Here is my code if it helps. If I should post this to a different forum would someone please tell me.
NOTE: The app is running perfectly it just stops running after a time frame.
CODE:
public class MyServerApp{
//...variable delaration etc.
try{
server = new ServerSocket(5252);//listen to the socket
//tried without this, with it set to 0, and with this number
//server.setSoTimeout(360000000);
}catch(IOException e){
System.exit(-1);
}
while(true){
MyConnectionThread w;//thread that handles communication
try{
w = new MyConnectionThread(server.accept());//receive new client
Thread t = new Thread(w);//create new thread with our handler
t.start();//start new thread
} catch (IOException e) {
System.exit(-1);
}
}
}
//...clean up
}
class MyConnectionThread implements Runnable{//communication handler
//...
public void run(){//when run
//...variable declaration etc.
try{
//get streams from client socket
in = new BufferedReader(new InputStreamReader(client.getInputStream()));
out = new ObjectOutputStream(client.getOutputStream());
} catch (IOException e) {...}
while(true){
try{
line = in.readLine();//get data from client
out.writeBoolean(true);//test to see if running
out.flush();//flush information
break;//break out of loop
}catch(IOException e){break;}
}
try{//clean up
in.close();
out.close();
}catch(Exception e){...}
}
//...other functions
}
Hope you can help me from here. I am running it on a linux server.