listener   xtlang


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

Implementation

(bind-func listener
  (let ((sock (nn_socket AF_SP NN_PULL))
        (buflen:i64 1024)
        (buf:i8* (zalloc buflen)))
    (if (or (< sock 0)
            (< (nn_bind sock "ipc:///tmp/pipeline.ipc") 0))
        (nn_println_strerror))
    (lambda ()
      (let ((bytes (nn_recv sock buf buflen NN_DONTWAIT)))
        (if (> bytes 0) buf "")))))


Back to Index

Similar Entries

  • listener-callback    scheme
  • scheme-midi-listener    scheme
  • xhid_listener    scheme