@Override
	public void run() {
		// connect to traffic server
		try {
			socket = new Socket(hostname,port);
			input = new BufferedReader(new InputStreamReader(socket.getInputStream()));
		}
		catch (IOException e) {
			System.out.println("ERROR: Can't connect to server");
			return;
		}
		
		// update traffic data
		try {
			while (running.get()) {
				String line = input.readLine().trim();
//				System.out.println(line);
				String[] data = line.split("[\t]");
				try {
					String streetName = data[0];
					Double value = Double.parseDouble(data[1]);
					if (value > 0) {
						synchronized(trafficData) {
							trafficData.put(streetName, value);
						}
					}
				} catch (NumberFormatException e) {
					// ignore improperly formatted data
				} catch (IndexOutOfBoundsException e) {
					// ignore improperly formatted data
				}
			}
		}
		catch (IOException e) {
			System.out.println("ERROR: Disconnected from traffic server");
		} 
		
	}