Skip to content

Instantly share code, notes, and snippets.

#include <czmq.h>
int main (void) {
int repeat;
for (repeat = 0; repeat < 1000; repeat++) {
zctx_t *ctx = zctx_new ();
void *backend = zsocket_new (ctx, ZMQ_DEALER);
void *frontend = zsocket_new (ctx, ZMQ_DEALER);
int rc = zsocket_bind (backend, "ipc://@/something:%d", repeat);
@hintjens
hintjens / test_timer.c
Created November 15, 2014 10:45
test timers & tickets
/*
Shows relative performance of zloop timers vs tickets
The problem is when you have large numbers of DEALER clients talking
to a ROUTER server, and the server wants to expire idle clients with
some timeout, e.g. 30 seconds. Using zloop timers, this means deleting
and then recreating a timer for each received message. zloop does not
order its timers, and even if it did, finding a timer means searching
the list, an O(N) cost.
if !defined (my.field.type)
echo "field
endif
if type = "number"
elsif type = "string"
elsif type = "longstr"
elsif type = "chunk" | type = "frame" | type = "msg" | type = "list" | type = "hash"
elsif type = "msg"
if type = "number"
/* =========================================================================
hydrad - command-line service
Copyright (c) the Contributors as noted in the AUTHORS file.
This file is part of the Hydra Project
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
=========================================================================
#include <malamute.h>
int main (void) {
zactor_t *server = zactor_new (mlm_server, NULL);
zsock_send (server, "sss", "SET", "server/verbose", "1");
zsock_send (server, "ss", "BIND", "inproc://testcase");
mlm_client_verbose = true;
mlm_client_t *client = mlm_client_new ();
int rc = mlm_client_connect (client, "inproc://testcase", 2000, "");
zactor_t *server = zactor_new (mlm_server, "malamute");
zsock_send (server, "ssi", "SET", "server/verbose", false);
zsock_send (server, "sss", "SET", "server/timeout", "0");
zsock_send (server, "ss", "BIND", "inproc://some-port");
/* =========================================================================
zyre_perf - bulk test tool
This tool starts a number R of responders, then sends M messages to each
responder, and waits for responses.
This test runs in a single process and does the following:
A master thread sends N "shout" messages to R responders
Each responder sends a unicast "whisper" response back to the master
diff --git a/src/xrep.cpp b/src/xrep.cpp
index 978ed0b..5fd6cbb 100644
--- a/src/xrep.cpp
+++ b/src/xrep.cpp
@@ -143,8 +143,11 @@ int zmq::xrep_t::xsend (zmq_msg_t *msg_, int flags_)
if (!more_out) {
zmq_assert (!current_out);
- // There's no such thing as prefix with no subsequent message.
- zmq_assert (msg_->flags & ZMQ_MSG_MORE);
To bridge 0MQ to SoupTCP, create a proxy that connects to SoupTCP at the frontend and publishes updates to a 0MQ network at the backend:
[[code type="textdiagram"]]
+------------+
| |
| NASDAQ |
| |
+------------+
| SoupTCP |
\------------/
Demonstrating WireAPI overflow in direct mode.
Window 1
amq_server --direct 1
Window 2
server
Window 3
client