After EOFException variable=null
If I end the client session a EOFException is thrown but I read that this
would be normal so I just start a new thread with the same functionality
but the value of Restaurant=null; although i wrote it in a .txt file
public void run(){
try {
ois= new ObjectInputStream(clientside.getInputStream());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
oos = new ObjectOutputStream(clientside.getOutputStream());
} catch (IOException e3) {
// TODO Auto-generated catch block
e3.printStackTrace();
}
handlerequest(ois,oos);// exit();
}
I dont think that you need the code of my request handler so I wont attach
it to reduce code spamming. The method which invokes the following is the
requesthandler
String tempRestaurant=null;
try {
fr = new FileReader("Restaurant.txt");
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
fr.read(cbuf);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
tempRestaurant=String.valueOf(cbuf);
System.out.println(tempRestaurant);
try {
oos.writeObject(tempRestaurant);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
fr.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
I´m looking foward to your help pls write if you need more information
code etc. :)
No comments:
Post a Comment