i don\'t know why java.io.EOFException appear. i want to write a file after i get binary stream from server.
Here\'s my code
inputSt
It depends when you use client - server implementation and client is "always up" and socket is keeping whole time.
if socket connection is up and you use for example ObjectInputStream so "EOFException" will appear when client close socket (socket.close) or "java.net.SocketException: Connection" reset will apper when socket.close() isnt check at finally for sure...
But if you keep client and socket connection up ObjectInputStream.readObject() will stay and listen what is what you want in this scenario. and yes when you call only read() you will get -1 and if client is killed and you are handling for one client one thread at server you will only get -1 and thread will live foreever (if you dont kill it manualy or kill whole server)