日期:2014-05-20 浏览次数:20964 次
// receiver class class ServerListener extends Thread{ Socket serverSocket = null; @Override public void run() { while(true){ try { Log.w(TAG_LISTENER, "ServerListener run() {"); serverSocket = mSocket.accept(); BufferedInputStream in = new BufferedInputStream(serverSocket.getInputStream()); byte[] reader = new byte[10]; int count = 0; boolean flag = false; while((count = in.read(reader))>0){ <--- 执行不下去了 flag = true; bq.enQueue(reader[0]); Log.w(TAG_LISTENER, reader.toString() + " is added to byteQueue"); } Log.w(TAG_LISTENER, "***** ServerSender start"); if(flag){ new ServerSender(serverSocket).start(); flag = false; } } catch (IOException e) { e.printStackTrace(); } Log.w(TAG_LISTENER, "}"); } } }