日期:2014-05-20 浏览次数:20838 次
class Request implements Runnabek{
OutputStream os;
Queue<byte[]> queue;//用concurrent下面的类
public void run(){
while(true){
// os().send(queue.pop());
}
}
public synchronized void send(byte[] bs){
queue.offer(bs);
}
}
class Response implements Runnabek{
IputStream is;
byte[] cache = new byte[1024];
public void run(){
while(true){
int len = is.read(cache);
// handle(cache, 0, len);
}
}
}
new Thread(new Request(socket.getOutputStream())).start();
new Thread(new Response(socket.getInputStream())).start();
_____________ ______________ _____________
------解决方案--------------------
------解决方案--------------------
------解决方案--------------------
------解决方案--------------------
request
------解决方案--------------------
------解决方案--------------------
------解决方案--------------------