All pastes #29421 Raw Edit

Anonymous

public text v1 · immutable
#29421 ·published 2005-11-20 01:13 UTC
rendered paste body
	public void run(){
		buddyList = new ArrayList <User> (10);
		outputQueue = new ArrayList <byte[]> (10);
		inputQueue = new ArrayList <byte[]> (10);
		msgEncoder = new MSGEncoder(this);
		decoder = new MSGDecoder(this);
		
		socket = connect();
		try{
			
			reader = new Reader(this , socket.getInputStream());
			new Thread((Runnable)reader).start();
			
			writer = new Writer( outputQueue , socket.getOutputStream());
			new Thread((Runnable)writer).start();
			
		}catch(Exception e){e.printStackTrace(); System.exit(1);}
		
		while(run){
			/* HANDEL MSGS FROM SERVER */
			handleServerMessages();
			
			/* RELAY MSGS TO LISTENERS */
			relayToListeners();
			
			/* HANDEL MSGS FROM CLIENT */
			handleClientMsgs();
			
			try{Thread.sleep(100);}catch(Exception e){ e.printStackTrace();}
		}
	}