我现在感觉真的很愚蠢......基本上我在本地机器上通过 TCP 连接......当我尝试在客户端制作输入/输出流时,它不会通过创建对象输入流。是什么赋予了?这在打印 2 后停止......没有例外或任何东西......这不是我第一次使用这个类,这也是我感到困惑的部分原因。
try {
System.out.println("1");
mySocket = new Socket("localhost", 11311);
System.out.println("12");
oos = new ObjectOutputStream(mySocket.getOutputStream());
System.out.println("2");
ois = new ObjectInputStream(mySocket.getInputStream());
System.out.println("13");
} catch (Exception e) {
e.printStackTrace();
}