| 1 | package cz.vutbr.feec.session.feedback; |
| 2 | |
| 3 | import java.net.InetAddress; |
| 4 | import java.net.SocketException; |
| 5 | |
| 6 | public class FeedbackSession extends FeedbackSessionStatus { |
| 7 | private static final int DEFAULT_PERIOD = 5000; |
| 8 | |
| 9 | public FeedbackSession(InetAddress feedbackAddress, int feedbackPort) { |
| 10 | super(); |
| 11 | try { |
| 12 | inMulticast = new ThreadInMulticast(); |
| 13 | inUnicast = new ThreadInUnicast(feedbackPort); |
| 14 | outUnicast = new ThreadOut(feedbackAddress, feedbackPort, DEFAULT_PERIOD); |
| 15 | } catch (SocketException e) { |
| 16 | e.printStackTrace(); |
| 17 | System.exit(-1); |
| 18 | } |
| 19 | initThread(); |
| 20 | } |
| 21 | |
| 22 | @Override |
| 23 | public void startSession() { |
| 24 | inMulticast.startThread(); |
| 25 | inUnicast.startThread(); |
| 26 | outUnicast.startThread(); |
| 27 | |
| 28 | } |
| 29 | |
| 30 | @Override |
| 31 | public void stopSession() { |
| 32 | inMulticast.stopThread(); |
| 33 | inUnicast.stopThread(); |
| 34 | outUnicast.stopThread(); |
| 35 | |
| 36 | } |
| 37 | } |