package cz.vutbr.feec.session.gnp;

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

public class GNPSession extends GNPSessionStatus {
	private static final int DEFAULT_PERIOD = 5000; 
	
	public GNPSession(InetAddress feedbackAddress, int feedbackPort) {
		super();
		try {
			inMulticast = new ThreadInMulticast();
			inUnicast = new ThreadInUnicast(feedbackPort);
			outUnicast = new ThreadOut(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();
		
	}
}
