在后面加上一句看看这个线程终止了没有?
/觉得很怪,你是怎么在writeThread中得到 Socket client的?
public  static void processSend(byte[] sourceStr) {
      try{
          writeData= new DataOutputStream(client.getOutputStream());
      }catch(IOException e){}
          writeThread write=new writeThread(sourceStr);
          write.start();
          try{
            write.join();
          }catch(InterruptedException e){
          }
    System.out.printlne("send finish!");
    }

解决方案 »

  1.   

    发送及接收我把它包装成内部线程类
     static final class readThread extends Thread{
        ByteArrayOutputStream aos;    public void run(){     BufferedInputStream bis=new BufferedInputStream(readData);
         aos=new ByteArrayOutputStream();
            try {
                 byte[] buf=new byte[1024];
                 
                 while(true){
                  int count=bis.read(buf,0,1024);
                  if(count==-1)break;
                  aos.write(buf,0,count);
                 }
               
            } catch (Exception e) {
                System.out.println("Error read data ");
            }
        }
     }
     
     static final class writeThread extends Thread{
     
       private byte[] source;
       
       public writeThread(byte[] source){
        this.source=source;
       }
       
       public void run(){
           try {
                writeData.write(source);
                writeData.flush();
                
           } catch (IOException e) {
                System.out.println("Error reading from file: " +new String(source));
            }
       } 
     }
      

  2.   

    我是说线程池,不是连接池
    我需要的是client端进程