Continuously read objects from an ObjectInputStream in Java

后端 未结 4 1531
时光说笑
时光说笑 2020-12-12 04:48

I have a problem using an ObjectInputStream and I have been struggling with it for 2 days now. I tried to search for a solution but unfortunately found no fitting answer.

4条回答
  •  时光取名叫无心
    2020-12-12 05:13

    EOFException is thrown by readObject() when the peer has closed the connection. There can never be more data afterwards. Ergo you can't have written multiple objects at all: you closed the connection instead.

提交回复
热议问题