Haïkel Guémar
Fedora Packager since 2006
Senior Software Engineer @ SysFera
Written by Martin Sustrik (co-creator of ZeroMQ)
MIT licensed
Release 0.1 alpha (20 august 2013)
Release 0.2 alpha (25 september 2013)
Zero
Sustrik wanted:
No drama, few jokes and encouragements from both sides
Aims POSIX full-compliance
Written in C
API for integrating new protocols and transports
command-line tools (nanocat)
/* with zeromq */
void *ctx = zmq_ctx_new ();
void *s = zmq_socket (ctx, ZMQ_PUSH);
zmq_connect (s, "tcp://192.168.0.111:5555");
zmq_send (s, "ABC", 3, 0);
zmq_close (s);
zmq_ctx_destroy (ctx);
/* with nanomsg */
int s = nn_msg(AF_SP, NN_PUSH);
nn_connect(s, "tcp://192.168.0.111:5555");
nn_send(s, "ABC", 3, 0);
nn_close(s); /* attention, appel désormais bloquant */
void *buf = nn_allocmsg(12, 0);
memcpy(buf, "Hello world!", 12);
nn_send(s, &buf, NN_MSG, 0);
nn_recv(s, &buf, NN_MSG, 0);
nn_freemsg(buf);
# server-side
nanocat --rep --bind tcp://127.0.0.1:8000 --format ascii --data pong
# client side
nanocat --req --connect tcp://127.0.0.1:8000 --format ascii --data ping
!bash nanocat --pub --connect tcp://darthsidious --data "My liege !" --interval 10
int sock = nn_socket(AF_SP, NN_PAIR);
nn_connect(sock, url);
nn_send(sock, "hello", 6, 0);
char *buf = NULL;
int result = nn_recv(sock, &buf, NN_MSG, 0);
nn_freemsg(buf);
nn_shutdown(sock, 0);
int sock = nn_socket(AF_SP, NN_PAIR);
nn_bind(sock, url);
char *buf = NULL;
int result = nn_recv(sock, &buf, NN_MSG, 0);
nn_freemsg(buf);
nn_send(sock, "kthxbye", 8, 0);
nn_shutdown(sock, 0);
int sz_msg = strlen(msg) + 1;
int sock = nn_socket(AF_SP, NN_REQ);
nn_connect(sock, url);
int bytes = nn_send(sock, msg, sz_msg, 0);
nn_shutdown(sock, 0);
int sock = nn_socket(AF_SP, NN_REP);
nn_bind(sock, url);
while (1) {
char *buf = NULL;
int bytes = nn_recv(sock, &buf, NN_MSG, 0);
nn_freemsg(buf);
}
int sz_msg = strlen(msg) + 1;
int sock = nn_socket(AF_SP, NN_PUSH);
nn_connect(sock, url);
int bytes = nn_send(sock, msg, sz_msg, 0);
nn_shutdown(sock, 0);
int sock = nn_socket(AF_SP, NN_PULL);
nn_bind(sock, url);
while (1) {
char *buf = NULL;
int bytes = nn_recv(sock, &buf, NN_MSG, 0);
nn_freemsg(buf);
}
Choose your weapons, cowboy !
C++, Go, Java, node.js, lua/luajit, .Net, OCaml, Perl, PHP, Python, Ruby, Rust
Table of Contents | t |
---|---|
Exposé | ESC |
Full screen slides | e |
Presenter View | p |
Source Files | s |
Slide Numbers | n |
Toggle screen blanking | b |
Show/hide slide context | c |
Notes | 2 |
Help | h |