这是我的客户代码
Random rand = new Random();
int n = rand.nextInt(50) + 1;
DataInputStream dis = new DataInputStream(_socket.getInputStream());
DataOutputStream dos = new DataOutputStream(_socket.getOutputStream());
dos.writeInt(n);
这是服务器代码
try {
DataInputStream dis = new DataInputStream(socket.getInputStream());
BufferedReader input = new BufferedReader(new InputStreamReader(dis));
int fromClient = input.read();
System.out.println(fromClient);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
但是我在 fromClient 中没有收到任何内容,即使我像这样更改它
System.out.println(fromClient+"test");
我没有结果