java.io.StreamCorruptedException: invalid stream header: 75720002

后端 未结 1 1011
南旧
南旧 2021-01-18 08:45

i am creating a server-client application where the server sends a pdf file to the all connected clients. The problem is i get this error and i searched for a solution but c

相关标签:
1条回答
  • 2021-01-18 09:37

    BufferedReader can buffer more data from the socket than you've read yet. So on the client side, the header of your byte[] has probably already been read and buffered by your inFromServer reader, and will not be available to your ObjectInputStream.

    Don't do that kind of thing. Either do all your marshaling "manually" (using the PrintWriter/BufferedReader pair), or do it all with object serialization with ObjectOutputStream/ObjectInputStream.

    0 讨论(0)
提交回复
热议问题