(index ("nn-socket" 0) ("nn-bind" 261) ("nn-connect" 606) ("nn-subscribe" 802) ("nn-recv" 1171) ("nn-send" 1449) ("nn-recv*" 1747) ("nn-recv!" 2193) ("nn-close" 2463))
(def (sig (procedure " (nn-socket protocol [domain])" (id nn-socket))) (p "Create a nanomsg socket. Protocol can be any of the symbols pair, pub, sub, pull, push, req, rep, surveyor, respondent or bus. Domain can be the symbol sp or raw, and defaults to sp."))
(def (sig (procedure " (nn-bind socket address)" (id nn-bind))) (p (link "http://nanomsg.org/v0.6/nn_bind.3.html" "Binds") " nanomsg socket to address, where address is a string of the form \"ipc:///var/ipc/music.nn.pair\" or \"tcp://0.0.0.0:10080\". If the nn-library can't parse the address string, it throws an \"Illegal argument\" error."))
(def (sig (procedure " (nn-connect socket address)" (id nn-connect))) (p (link "http://nanomsg.org/v0.6/nn_connect.3.html" "Connects") " nanomsg socket " (tt "socket") " to " (tt "address") "."))
(def (sig (procedure " (nn-subscribe socket prefix)" (id nn-subscribe))) (p "Set the " (link "http://nanomsg.org/v0.6/nn_pubsub.7.html" "NN_SUBSCRIBE") " option on " (tt "socket") " which will make the socket receive to all messages that start with " (tt "prefix") ". Note that if this is never called, " (tt "(nn-sock 'sub)") " sockets will never receive anything."))
(def (sig (procedure " (nn-recv socket)" (id nn-recv))) (p "Receive a message from socket. This blocks until a message is received from nanomsg, but it does not block other srfi-18 threads. It always returns a string. An error is thrown if the socket is in an illegal state."))
(def (sig (procedure " (nn-send socket msg)" (id nn-send))) (p "Send a message on " (tt "socket") ", using the socket's semantics. " (tt "msg") " must be a string.") (p "In the current implementation, this operation may block for certain protocols in which case other srfi-18 threads block too."))
(def (sig (procedure " (nn-recv* socket flags)" (id nn-recv*))) (p "Receive a message from socket. This will block other srfi-18 threads, unless the " (tt "nn/dontwait") " flag is specified, in which case " (tt "nn-recv*") " will immediately with either a message as a string or #f (for EAGAIN). An error is thrown if " (tt "socket") " is in an illegal state.") (p "Note that memory is copied from the nanomsg buffer into a new scheme string."))
(def (sig (procedure " (nn-recv! socket buffer size flags)" (id nn-recv!))) (p "A version of " (tt "nn-recv*") " which requires a preallocated buffer. If the size of the buffer can be found automatically (using " (tt "number-of-bytes") "), size can be " (tt "#f") "."))
(def (sig (procedure " (nn-close socket)" (id nn-close))) (p "Explicitly close " (tt "socket") ". This is normally not needed as this is done in the socket's finalizer."))
