View Single Post
Old 11-26-2004, 03:29 PM   PM User | #14
rynox
New Coder

 
Join Date: Aug 2002
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
rynox is an unknown quantity at this point
Here's why:

Line 1, I made this synchronized because many different threads could access this method at once if I didn't. I encountered race problems.
Line 2, Return an array of rServer (client) threads.
Line 3, for loop to loop through active client threads
Line 5, if thread is not current client thread...
Line 6, echo to client's Outputstream.

Code:
 1	public synchronized void command(String cmd, rServer t) {
 2		rServer[] rsv=rsr.getClientThreads();
 3		for(int i=0;i<rsv.length;i++) {
 4			try {
 5				if(rsv[i]!=t) {
 6					rsv[i].out.writ...
 7				}
 8			} catch (Exception e) { }
 9		}
10	}
rynox is offline   Reply With Quote