#![crate_name = "taskwork"]
use std::io::{self, Write};
use std::thread;
use std::time::Duration;
fn atoi(s: &str) -> u64 {
s.parse().unwrap()
}
fn main() {
let context = zmq::Context::new();
let receiver = context.socket(zmq::PULL).unwrap();
assert!(receiver.connect("tcp://localhost:5557").is_ok());
let sender = context.socket(zmq::PUSH).unwrap();
assert!(sender.connect("tcp://localhost:5558").is_ok());
loop {
let string = receiver.recv_string(0).unwrap().unwrap();
print!(".");
let _ = io::stdout().flush();
thread::sleep(Duration::from_millis(atoi(&string)));
sender.send("", 0).unwrap();
}
}