我从服务器获取一个对象。 这是我的代码:
ObjectInputStream in = new ObjectInputStream(socket.getInputStream());
in.readObject();
Exception in thread "main" java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:209)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at java.net.SocketInputStream.read(SocketInputStream.java:223)
at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java:2303)
at java.io.ObjectInputStream$BlockDataInputStream.peek(ObjectInputStream.java:2596)
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2606)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1319)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
at cs380p6re.TicTacToe.main(TicTacToe.java:29)
in.readObject()在第29行。我确定服务器正在向我发送该对象。如果我用我的朋友来运行这个'笔记本电脑,它工作。但如果我使用我的笔记本电脑运行它,它会给我这样的错误。我已尝试使用eclipse和终端,但我得到了相同的结果。请帮忙。