Sha256: 0215434a05afa531e2e7d1fe0254600d83da6f03c6b6546ee55554ffe1235578
Contents?: true
Size: 1.9 KB
Versions: 3
Compression:
Stored size: 1.9 KB
Contents
zstr(3) ======= NAME ---- zstr - sending and receiving strings SYNOPSIS -------- ---- // Receive a string off a socket, caller must free it CZMQ_EXPORT char * zstr_recv (void *socket); // Receive a string off a socket if socket had input waiting CZMQ_EXPORT char * zstr_recv_nowait (void *socket); // Send a formatted string to a socket CZMQ_EXPORT int zstr_send (void *socket, const char *format, ...); // Send a formatted string to a socket, with MORE flag CZMQ_EXPORT int zstr_sendm (void *socket, const char *format, ...); // Self test of this class CZMQ_EXPORT int zstr_test (bool verbose); ---- DESCRIPTION ----------- The zstr class provides utility functions for sending and receiving C strings across 0MQ sockets. It sends strings without a terminating null, and appends a null byte on received strings. This class is for simple message sending. EXAMPLE ------- .From zstr_test method ---- zctx_t *ctx = zctx_new (); assert (ctx); void *output = zsocket_new (ctx, ZMQ_PAIR); assert (output); zsocket_bind (output, "inproc://zstr.test"); void *input = zsocket_new (ctx, ZMQ_PAIR); assert (input); zsocket_connect (input, "inproc://zstr.test"); // Send ten strings, five strings with MORE flag and then END int string_nbr; for (string_nbr = 0; string_nbr < 10; string_nbr++) zstr_send (output, "this is string %d", string_nbr); for (string_nbr = 0; string_nbr < 5; string_nbr++) zstr_sendm (output, "this is string %d", string_nbr); zstr_send (output, "END"); // Read and count until we receive END string_nbr = 0; for (string_nbr = 0;; string_nbr++) { char *string = zstr_recv (input); if (streq (string, "END")) { free (string); break; } free (string); } assert (string_nbr == 15); zctx_destroy (&ctx); ---- SEE ALSO -------- linkczmq:czmq[7]
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rbczmq-1.7.1 | ext/czmq/doc/zstr.txt |
rbczmq-1.7.0 | ext/czmq/doc/zstr.txt |
rbczmq-1.6.4 | ext/czmq/doc/zstr.txt |