JAVA为服务器的:
pw.write(str);
pw.flush();android是客户端:
public void run() {
// TODO Auto-generated method stub
String buf;
try {
while (true) {
if (!socket.isClosed()) {
if (socket.isConnected()) {
if (!socket.isInputShutdown()) {
if ((buf=in.readLine())!= null) {
//content += "\n";
content=content+buf+"\n";
mHandler.sendMessage(mHandler.obtainMessage());
} else {
}
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
谁能帮忙解决一下,接收后content总是少了最后一行.
pw.write(str);
pw.flush();android是客户端:
public void run() {
// TODO Auto-generated method stub
String buf;
try {
while (true) {
if (!socket.isClosed()) {
if (socket.isConnected()) {
if (!socket.isInputShutdown()) {
if ((buf=in.readLine())!= null) {
//content += "\n";
content=content+buf+"\n";
mHandler.sendMessage(mHandler.obtainMessage());
} else {
}
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
谁能帮忙解决一下,接收后content总是少了最后一行.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货