<commit_before># zmqc

zmqc is a small but powerful command-line interface to [ØMQ][zmq]. It allows
you to create a socket of a given type, bind or connect it to multiple
addresses, set options on it, and receive or send messages over it using
standard I/O, in the shell or in scripts. It's useful for debugging and
experimenting with most possible network topologies.

  [zmq]: http://www.zeromq.org/

## Installation

    pip install zmqc


## Usage

    zmqc [-h] [-v] [-0] (-r | -w) (-b | -c) SOCK_TYPE [-o SOCK_OPT=VALUE...] address [address ...]


### Mode

<dl>
  <dt>-r, --read</dt>
    <dd>Read messages from the socket onto stdout.</dd>

  <dt>-w, --write</dt>
    <dd>Write messages from stdin to the socket.</dd>
</dl>


### Behavior

<dl>
  <dt>-b, --bind</dt>
    <dd>Bind to the specified address(es).</dd>
  <dt>-c, --connect</dt>
    <dd>Connect to the specified address(es).</dd>
</dl>


### Socket Parameters

<dl>
  <dt>SOCK_TYPE</dt>
  <dd>
    Which type of socket to create. Must be one of `PUSH`, `PULL`, `PUB`, `SUB`
    or `PAIR`. See `man zmq_socket` for an explanation of the different types.
    `REQ`, `REP`, `DEALER` and `ROUTER` sockets are currently unsupported.
    **--read** mode is unsupported for PUB sockets, and **--write** mode is
    unsupported for `SUB` sockets.
  </dd>
  <dt>-o SOCK_OPT=VALUE, --option SOCK_OPT=VALUE</dt>
  <dd>
    Socket option names and values to set on the created socket. Consult `man
    zmq_setsockopt` for a comprehensive list of options. Note that you can
    safely omit the `ZMQ_` prefix from the option name. If the created socket
    is of type `SUB`, and no `SUBSCRIBE` options are given, the socket will
    automatically be subscribed to everything.
  </dd>
  <dt>address</dt>
  <dd>
    One or more addresses to bind/connect to. Must be in full ZMQ format (e.g.
    `tcp://<host>:<port>`)
  </dd>
</dt>


## Examples

    zmqc -rc SUB 'tcp://127.0.0.1:5000'

Subscribe to `tcp://127.0.0.1:5000`, reading messages from it and printing them
to the console. This will subscribe to all messages by default.

* * * *

    ls | zmqc -wb PUSH 'tcp://*:4000'<commit_msg>Added an example of socket options to the README.<commit_after># zmqc

zmqc is a small but powerful command-line interface to [ØMQ][zmq]. It allows
you to create a socket of a given type, bind or connect it to multiple
addresses, set options on it, and receive or send messages over it using
standard I/O, in the shell or in scripts. It's useful for debugging and
experimenting with most possible network topologies.

  [zmq]: http://www.zeromq.org/

## Installation

    pip install zmqc


## Usage

    zmqc [-h] [-v] [-0] (-r | -w) (-b | -c) SOCK_TYPE [-o SOCK_OPT=VALUE...] address [address ...]


### Mode

<dl>
  <dt>-r, --read</dt>
    <dd>Read messages from the socket onto stdout.</dd>

  <dt>-w, --write</dt>
    <dd>Write messages from stdin to the socket.</dd>
</dl>


### Behavior

<dl>
  <dt>-b, --bind</dt>
    <dd>Bind to the specified address(es).</dd>
  <dt>-c, --connect</dt>
    <dd>Connect to the specified address(es).</dd>
</dl>


### Socket Parameters

<dl>
  <dt>SOCK_TYPE</dt>
  <dd>
    Which type of socket to create. Must be one of `PUSH`, `PULL`, `PUB`, `SUB`
    or `PAIR`. See `man zmq_socket` for an explanation of the different types.
    `REQ`, `REP`, `DEALER` and `ROUTER` sockets are currently unsupported.
    **--read** mode is unsupported for PUB sockets, and **--write** mode is
    unsupported for `SUB` sockets.
  </dd>
  <dt>-o SOCK_OPT=VALUE, --option SOCK_OPT=VALUE</dt>
  <dd>
    Socket option names and values to set on the created socket. Consult `man
    zmq_setsockopt` for a comprehensive list of options. Note that you can
    safely omit the `ZMQ_` prefix from the option name. If the created socket
    is of type `SUB`, and no `SUBSCRIBE` options are given, the socket will
    automatically be subscribed to everything.
  </dd>
  <dt>address</dt>
  <dd>
    One or more addresses to bind/connect to. Must be in full ZMQ format (e.g.
    `tcp://<host>:<port>`)
  </dd>
</dt>


## Examples

    zmqc -rc SUB 'tcp://127.0.0.1:5000'

Subscribe to `tcp://127.0.0.1:5000`, reading messages from it and printing them
to the console. This will subscribe to all messages by default (you don't need
to set an empty `SUBSCRIBE` option). Alternatively:

    zmqc -rc SUB -o SUBSCRIBE='com.organization.' 'tcp://127.0.0.1:5000'

This will subscribe to all messages starting with `com.organization.`.

* * * *

    ls | zmqc -wb PUSH 'tcp://*:4000'
{'fraction_non_alphanumeric': 0.13759647188533627, 'fraction_numerical': 0.013230429988974642, 'mean_word_length': 3.112420670897552, 'pattern_counts': {'":': 0, '<': 75, '<?xml version=': 0, '>': 75, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 5, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3884799', 'n_tokens_mistral': 1630, 'n_tokens_neox': 1528, 'n_words': 604}