(bind-func request
(let ((buflen:i64 1024)
(buf:i8* (zalloc buflen)))
(lambda (msg:i8*)
(let ((sz_msg (+ (strlen msg) 1))
(bytes (nn_send REQUEST_SOCKET msg sz_msg 0)))
(if (= bytes (convert sz_msg)) ;; should also check (< bytes (convert sz_msg))
(let ((rbytes (nn_recv REQUEST_SOCKET buf buflen 0)))
(if (> rbytes 0)
(begin (printf "reply received: %s\n" buf)
void)))
(nn_println_strerror "error in request"))))))