Hi I am creating a small p2p program, implementing both the server and client side. When I have lunch for a client program, first think what it takes to connect to each server in its list, send data (about the client side) and disconnect. The next time the client side connects to one of these servers, it will be recognized.
My problem is when I tell the client side about disconnection, I get this exception
java.io.EOFException
at java.io.DataInputStream.readUnsignedShort(Unknown Source)
at java.io.DataInputStream.readUTF(Unknown Source)
at java.io.DataInputStream.readUTF(Unknown Source)
at oop.ex3.nameserver.NameServerThread.run(NameServerThread.java:24)
to disable i just wrote:
finally {
out.close();
in.close();
socket.close();
}
so how can i avoid this exception? thank!
source
share