(bind-func reply_loop
(let ((reqlen:i64 1024)
(reqbuf:i8* (zalloc reqlen))
(replen:i64 1024)
(repbuf:i8* (zalloc replen))
(running 1))
(lambda ()
(println "starting reply_loop...")
(while (= running 1)
(let ((reqbytes (nn_recv REPLY_SOCKET reqbuf reqlen 0)))
(if (> reqbytes 0)
(begin (sprintf repbuf "%s: message received from %.*s at time: %lld"
(getenv "USER") reqbytes reqbuf (now))
(if (< (nn_send REPLY_SOCKET repbuf (+ 1 (convert (strlen repbuf))) 0) 0)
(nn_println_strerror "error in user_name_handler"))))))
(println "stopping reply_loop"))))