package communication;


/*
 * Created on Sep 14, 2004
 *
 * To change the template for this generated file go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */

/**
 * @author tamer
 *
 * To change the template for this generated type comment go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
public class Receiver extends Thread{
	private boolean running=true;
	private Communicator com;
	private MessageParser messageParser;
	public Receiver(Communicator com, MessageParser messageParser){
		this.com = com;
		this.messageParser = messageParser;
	}
	
	public void run(){
		while (running) {
			String receive_data = com.receive();		
			messageParser.parse(receive_data);			
		}	
	}
	
	public void stopReiceiving(){
		running = false;
	}
}
