Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试图向服务器发送一个整数。这是我的客户代码
out = new PrintWriter(_socket.getOutputStream(), true); Random rand = new Random(); int n = rand.nextInt(50) + 1; out.println(n);
但是服务器如何读取它?
请改用 DataOutputStream.writeInt() / DataInputStream.readInt() 对。