package adaptive;

import java.net.*;

public class Receiver extends Thread {

	public static void main(String argv[]) throws Exception {
		String procFile = argv[0];
		String senderHost = argv[1];
		float thresholdBig = (new Float(argv[2])).floatValue();
		float thresholdSmall = (new Float(argv[3])).floatValue();
		
		ReceiverMonitor monitor = new ReceiverMonitor(thresholdBig, thresholdSmall, senderHost, procFile);
		monitor.start(); 

		try {
			DatagramSocket socket = new DatagramSocket(6787);
			byte[] buf = new byte[2000];
			DatagramPacket packet = new DatagramPacket(buf, buf.length);

			while (true) {
				socket.receive(packet);
				if (packet != null) {
					monitor.update(packet.getLength());
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}



//System.out.println("TESTE Tamanho: " + packet.getLength());
//linkUDP.total += packet.getLength();
