Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
990a1e86
Commit
990a1e86
authored
Dec 18, 2009
by
Martin Sustrik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zmq_cl(7) man page added
parent
bad22425
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
118 additions
and
3 deletions
+118
-3
zmq_cl.7
man/man7/zmq_cl.7
+118
-3
No files found.
man/man7/zmq_cl.7
View file @
990a1e86
...
...
@@ -2,8 +2,123 @@
.SH NAME
Common Lisp API for 0MQ lightweight messaging kernel
.SH SYNOPSIS
.SH DESCRIPTION
This manual page explains how Common Lisp API maps to underlying C
API.
Common Lisp API repeats C API in general. All constants defined with C
API are available with Common Lisp API. C names are mapped to lisp
names by these rules: a) all names are `zmq' namespace; b) all names
are in lower case; c) underscores translate to dashes.
Example of mappings:
.IR zmq_msg_init_data
maps to
.IR zmq:msg-init-data
.IR ZMQ_PUB
maps to
.IR zmq:pub
To learn about individual functions and parameters check
appropriate C API manual pages.
For example, to understand
.IR zmq:setsockopt
function check
.BR zmq_setsockopt(3) .
.SH Data structures
Data structures are wrapped into CLOS classes with automatic memory
management. 0MQ describes two such structures:
.IR msg_t
and
.IR pollitem_t .
Message constructor supports keywords
.IR :size
and
.IR :data.
Keyword :size specifies the size of
message. Keyword :data specifies initial contents of message, and it
can be either string or 8-bit array. For example:
* (make-instance 'zmq:msg :data #(1 2 3))
creates a message with 3 bytes '1, 2, 3' in it.
.SH Accessing message data
There 3 functions to read message body in different forms:
msg-data-as-string, msg-data-as-array and msg-data-as-is, returning
data as string, as array and as raw foreign pointer to underlaying
buffer respectively. For example:
* (zmq:msg-data-as-array msg)
returns #(1 2 3) for message from previous example.
It is possible to access underlying foreign object via class slot
named `raw'.
* (slot-value obj 'zmq:raw)
or, if `obj' is of known type `msg':
* (zmq:msg-raw obj)
.SH Macros
There are several macroses to help with managing zeromq objects:
.SH with-context
Macro
.IR with-context
creates 0MQ context and requires 3 obligatory arguments: context name,
number of application threads and number of input/output
threads. Optional parameter `flags' can be also supplied, see
.BR zmq_init(3) .
Context is terminated implicitly at the end of macro block.
.SH with-socket
Macro
.IR with-socket
creates 0MQ socket within given context. Requires 3 arguments: socket
name, context name and socket type. See
.BR zmq_socket(3) .
Socket is closed implicitly at the end of macro block.
.SH with-polls
Macro
.IR with-polls
creates 0MQ polls, containing different sets of pollitems. For
example, to create two poll sets for network pipes:
* (zmq:with-polls ((poll1 . ((sock1 . zmq:pollin)
(sock2 . zmq:pollout)))
(poll2 . ((sock1 . zmq:pollout)
(sock2 . zmq:pollin))))
(process-sockets (zmq:poll poll-set1))
(process-sockets (zmq:poll poll-set2)))
Note,
.IR zmq:poll
returns list of revents for sockets from given poll set.
Polls are closed implicitly at the end of macro block.
.SH EXAMPLE
.nf
(zmq::with-context (ctx 1 1)
(zmq:with-socket (s ctx zmq:pub)
(zmq:connect s "tcp://192.168.0.115:5555")
(zmq:send s (make-instance 'zmq:msg :data "Hello, world!"))))
.SH "SEE ALSO"
.BR zmq(7)
.SH AUTHOR
Martin Sustrik <sustrik at 250bpm dot com>
Martin Sustrik <sustrik at 250bpm dot com>
,
Vitaly Mayatskikh <v dot mayatskih at gmail dot com>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment