out = new DataOutputStream(socket.getOutputStream());
in = new DataInputStream(socket.getInputStream());
// 接收字符串
byte[] buf = new byte[AppConfig.MAX_TCP_PACKAGE_LENGTH];
int num = 0;
num = in.read(buf);
String recv = new String(buf);
recv = recv.substring(0, num);
部分代码如上:请问num的长度为什么和recv的长度不一样呢,怎么截取呢。