请问大家见过这个异常吗java.io.StreamCorruptedException: invalid stream header: 7371007E异常求解

代码如下

package Chat;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.net.Socket;

public class ClientConServerThread extends Thread{
    private Socket client;
    public ClientConServerThread(Socket client){
        this.client=client;
    }

    public Socket getClient() {
        return client;
    }

    public void run(){
        while(true){
            try {
                ObjectInputStream ois = new ObjectInputStream(client.getInputStream());//这里出现了异常
                Message m=(Message)ois.readObject();
                System.out.println(m.getCon());
            } catch (IOException | ClassNotFoundException e) {
                e.printStackTrace();
            }


        }
    }

}


异常如下
java.io.StreamCorruptedException: invalid stream header: 7371007E
at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:877)
at java.base/java.io.ObjectInputStream.(ObjectInputStream.java:350)
at Chat.ClientConServerThread.run(ClientConServerThread.java:20)
java.io.StreamCorruptedException: invalid stream header: 00007400
at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:877)
at java.base/java.io.ObjectInputStream.(ObjectInputStream.java:350)
at Chat.ClientConServerThread.run(ClientConServerThread.java:20)
java.io.StreamCorruptedException: invalid stream header: 01417400
at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:877)
at java.base/java.io.ObjectInputStream.(ObjectInputStream.java:350)
at Chat.ClientConServerThread.run(ClientConServerThread.java:20)
java.io.StreamCorruptedException: invalid stream header: 0C323031
at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:877)
at java.base/java.io.ObjectInputStream.(ObjectInputStream.java:350)
at Chat.ClientConServerThread.run(ClientConServerThread.java:20)
java.io.StreamCorruptedException: invalid stream header: 39303033
at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:877)
at java.base/java.io.ObjectInputStream.(ObjectInputStream.java:350)
at Chat.ClientConServerThread.run(ClientConServerThread.java:20)
java.io.StreamCorruptedException: invalid stream header: 30313134
at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:877)
at java.base/java.io.ObjectInputStream.(ObjectInputStream.java:350)
at Chat.ClientConServerThread.run(ClientConServerThread.java:20)
java.io.StreamCorruptedException: invalid stream header: 3274001C
at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:877)
at java.base/java.io.ObjectInputStream.(ObjectInputStream.java:350)
at Chat.ClientConServerThread.run(ClientConServerThread.java:20)
java.io.StreamCorruptedException: invalid stream header: 54756520
at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:877)
at java.base/java.io.ObjectInputStream.(ObjectInputStream.java:350)
at Chat.ClientConServerThread.run(ClientConServerThread.java:20)
java.io.StreamCorruptedException: invalid stream header: 41707220
at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:877)
at java.base/java.io.ObjectInputStream.(ObjectInputStream.java:350)
at Chat.ClientConServerThread.run(ClientConServerThread.java:20)
java.io.StreamCorruptedException: invalid stream header: 32382031
at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:877)
at java.base/java.io.ObjectInputStream.(ObjectInputStream.java:350)
at Chat.ClientConServerThread.run(ClientConServerThread.java:20)
java.io.StreamCorruptedException: invalid stream header: 353A3436
at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:877)
at java.base/java.io.ObjectInputStream.(ObjectInputStream.java:350)
at Chat.ClientConServerThread.run(ClientConServerThread.java:20)
java.io.StreamCorruptedException: invalid stream header: 3A313920
at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:877)
at java.base/java.io.ObjectInputStream.(ObjectInputStream.java:350)
at Chat.ClientConServerThread.run(ClientConServerThread.java:20)
java.io.StreamCorruptedException: invalid stream header: 43535420
at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:877)
at java.base/java.io.ObjectInputStream.(ObjectInputStream.java:350)
at Chat.ClientConServerThread.run(ClientConServerThread.java:20)
java.io.StreamCorruptedException: invalid stream header: 32303230
at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:877)
at java.base/java.io.ObjectInputStream.(ObjectInputStream.java:350)
at Chat.ClientConServerThread.run(ClientConServerThread.java:20)
java.io.StreamCorruptedException: invalid stream header: 74000C32
at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:877)
at java.base/java.io.ObjectInputStream.(ObjectInputStream.java:350)
at Chat.ClientConServerThread.run(ClientConServerThread.java:20)
java.io.StreamCorruptedException: invalid stream header: 30313930
at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:877)
at java.base/java.io.ObjectInputStream.(ObjectInputStream.java:350)
at Chat.ClientConServerThread.run(ClientConServerThread.java:20)
java.io.StreamCorruptedException: invalid stream header: 30333031
at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:877)
at java.base/java.io.ObjectInputStream.(ObjectInputStream.java:350)
at Chat.ClientConServerThread.run(ClientConServerThread.java:20)

Process finished with exit code -1

1个回答

在哪里给client值了

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐