package cz.vutbr.feec.session.feedback;

import java.net.InetAddress;
import java.net.SocketException;

public class FeedbackSession extends FeedbackSessionBase {
	private static final int DEFAULT_PERIOD = 5000; 
	
	public FeedbackSession(InetAddress feedbackAddress, int feedbackPort) {
		super();
		try {
			inMulticast = new ThreadInMulticast(status);
			inUnicast = new ThreadInUnicast(status, feedbackPort);
			outUnicast = new ThreadOut(status, feedbackAddress, feedbackPort, DEFAULT_PERIOD);
		} catch (SocketException e) {
			e.printStackTrace();
			System.exit(-1);
		}
		initThread();
	}

	public void startSession() {
		inMulticast.startThread();
		inUnicast.startThread();
		outUnicast.startThread();
		
	}

	public void stopSession() {
		inMulticast.stopThread();
		inUnicast.stopThread();
		outUnicast.stopThread();
		
	}
}
