日期:2014-05-20 浏览次数:20875 次
// 读取数据 private class readThread extends Thread { public void run() { BufferedInputStream inStream = null; String s = new String(); try { inStream = new BufferedInputStream(socket.getInputStream()); while (true) { byte[] buffer = new byte[1024]; inStream.read(buffer); String str = new String(buffer); Log.i("", str.trim()); s += str.trim(); Log.i("333333333333333333", s); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { Message msg = new Message(); Log.i("222222222", s); msg.obj = s; msg.what = 1; LinkDetectedHandler.sendMessage(msg); s = new String(); } } }