receiver   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/examples/contrib/nanomsg.xtm

Implementation

(bind-func receiver
  (let ((buflen:i64 1024)
        (buf:i8* (zalloc buflen)))
    (lambda ()
      (println "Starting receiver...")
      (let ((bytes (nn_recv RECV_SOCKET buf buflen 0)))
        (if (> bytes 0)
            (printf "message received: %s\n" buf)
            0)))))


Back to Index

Similar Entries