package auto;

import java.net.DatagramPacket;
import java.net.DatagramSocket;

public class ReceiverStreamingMonitor extends Thread {
	DatagramSocket socket = null;
	
	public ReceiverStreamingMonitor(DatagramSocket socket) {
		this.socket = socket;
	}

	public void run() {
		byte[] buf = new byte[2000];
		DatagramPacket packet = new DatagramPacket(buf, buf.length);

		try {
			//Main loop
			while (true) {
				//System.out.println("BEFORE");
				socket.receive(packet);
				//System.out.println("AFTER");

				Receiver.getInstance().verifyPacket(packet);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}