package fixed;

import java.net.*;

public class Receiver extends Thread {

	public static void main(String argv[]) throws Exception {
		String procFile = argv[0];
		
		ReceiverMonitor monitor = new ReceiverMonitor(procFile);
		monitor.start(); 

		try {
			DatagramSocket socket = new DatagramSocket(6257);
			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();
		}
	}
}