nanomsg Bindings
Synopsis
(import (network nanomsg))
Bindings to the nanomsg network library.
Conditions
condition: &nanomsg
procedure: (nanomsg-condition? any)
procedure: (make-nanomsg-condition message errno)
procedure: (nanomsg-condition-errno condition)
The &nanomsg condition type is derived from &message and stores an error code together with the message.
Operations
procedure: (nanomsg-constant symbol)
Retrieves the integer value associated by nanomsg with a given symbol. Naming convention is lower case with hyphens, as usual for Scheme, unlike the upper case with underscores convention used in C.
procedure: (socket? v)
Checks whether the given value is a nanomsg socket.
procedure: (open-socket domain protocol)
Creates a new nanomsg socket given symbols that identify the protocol to use. At some point in the future, the socket should be closed using close-socket.
procedure: (close-socket socket)
Closes the given socket. It does not hurt to call this procedure more than once on the same socket, but once it has been applied to a socket, it becomes unusable.
procedure: (socket-option socket level option)
Retrieves socket option data. The option is identified by the level and option symbols. The value is returned as a bytevector.
procedure: (socket-option-set! socket level option v)
Sets a socket option. The option is identified by the level and option symbols. The values is specified as a bytevector.
procedure: (socket-bind socket address)
Binds the socket to the local address specified as a string. Returns a numeric endpoint identifier.
procedure: (socket-connect socket address)
Connects the socket to the remote address specified as a string. Returns a numeric endpoint identifier.
procedure: (socket-shutdown socket id)
Closes the specified endpoint of the socket.
procedure: (socket-send socket message option ...)
Sends a bytevector through the socket. Option symbols may be passed to modify the behaviour of the operation.
procedure: (socket-receive socket length option ...)
Receives a bytevector through the socket. The maximum length of the message must be specified. Option symbols may be passed to modify the behaviour of the operation.
syntax: (socket-event symbol)
syntax: (socket-events symbol ...)
The socket event enumeration has the members in and out.
procedure: (socket-poll ((socket symbol ...) ...) timeout)
procedure: (socket-poll ((socket . events) ...) timeout)
procedure: (socket-poll #((socket symbol ...) ...) timeout)
procedure: (socket-poll #((socket . events) ...) timeout)
Polls the given sockets for the specified events. Event sets may be specified as lists of symbols (in or out) or as enumeration sets.
Returns a list of pairs of sockets and event enumeration sets. The result contains an elements for every socket for which the resulting event set is not empty.
The timeout is specified in seconds but has millisecond granularity.