写入一个数组或向量或文件或其他……然后每个客户机间隔一定时间读出来就OK……

解决方案 »

  1.   

     在server类中填入如下函数:
     void sendToAll( String message ) {
            synchronized( outputStreams )  
          for (Enumeration e = getOutputStreams(); e.hasMoreElements(); )  
            DataOutputStream dout = (DataOutputStream)e.nextElement();
             try {
              dout.writeUTF( message );
            } catch( IOException ie ) { System.out.println( ie ); }  
        }   
     }  
    }
    在从每个线程中调用该方法,就可以了.呵呵!!